-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Begin rewrite from GraphQL to REST based API
Special thanks to @javieraviles for the node-typescript-koa-rest boilerplate https://github.com/javieraviles/node-typescript-koa-rest
- Loading branch information
1 parent
5612660
commit c657997
Showing
34 changed files
with
721 additions
and
1,252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
PORT=3000 | ||
NODE_ENV=development | ||
JWT_SECRET=your-secret-whatever | ||
DATABASE__URL=postgres://postgres:mysecretpw@localhost:5432/postgres |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,63 +1,22 @@ | ||
/src/config/google/jwt.keys.json | ||
|
||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
# API keys and secrets | ||
.env | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
# Dependency directory | ||
node_modules | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
# Editors | ||
.idea | ||
*.iml | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
# OS metadata | ||
.DS_Store | ||
Thumbs.db | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
# Ignore built ts files | ||
dist/**/* | ||
|
||
# next.js build output | ||
.next | ||
# Logging files | ||
*.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"language": "node_js", | ||
"node_js": "8", | ||
"script": [ | ||
"npm run build", | ||
"npm run test" | ||
] | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,65 @@ | ||
{ | ||
"name": "podverse-api", | ||
"version": "1.0.0", | ||
"description": "Data API, database migration scripts, and backend services for all Podverse models.", | ||
"main": "dist/server.js", | ||
"scripts": { | ||
"addAllFeedsToQueue": "ts-node -r tsconfig-paths/register ./src/scripts/queue/addAllFeedsToQueue.ts", | ||
"parseFeed": "ts-node -r tsconfig-paths/register ./src/scripts/parser/parseFeed.ts", | ||
"parseAllFeedsFromQueue": "ts-node -r tsconfig-paths/register ./src/scripts/parser/parseAllFeedsFromQueue.ts", | ||
"queryUniquePageviews": "ts-node -r tsconfig-paths/register ./src/scripts/stats/queryUniquePageviews.ts", | ||
"receiveNextFeedFromQueue": "ts-node -r tsconfig-paths/register ./src/scripts/queue/receiveNextFeedFromQueue.ts", | ||
"start": "nodemon" | ||
"watch-server": "nodemon --watch 'src/**/*' -e ts,tsx --exec ts-node -r tsconfig-paths/register src/server.ts" | ||
}, | ||
"dependencies": { | ||
"license": "AGPLv3", | ||
"homepage": "https://github.com/podverse/podverse-api#readme", | ||
"keywords": [ | ||
"podcast", | ||
"episode", | ||
"RSS", | ||
"Atom", | ||
"feed", | ||
"parser", | ||
"feedparser", | ||
"database", | ||
"db", | ||
"sequelize", | ||
"podverse" | ||
], | ||
"devDependencies": { | ||
"@types/dotenv": "^4.0.3", | ||
"@types/google.analytics": "^0.0.39", | ||
"@types/koa": "^2.0.46", | ||
"@types/koa-bodyparser": "^5.0.1", | ||
"@types/koa-helmet": "^3.1.2", | ||
"@types/koa-jwt": "^3.3.0", | ||
"@types/koa-router": "^7.0.31", | ||
"@types/koa__cors": "^2.2.3", | ||
"@types/node": "^10.9.4", | ||
"apollo-errors": "^1.9.0", | ||
"apollo-server-koa": "^2.0.5", | ||
"aws-sdk": "^2.311.0", | ||
"@types/shelljs": "^0.8.0", | ||
"nodemon": "^1.18.4", | ||
"ts-node": "^7.0.1", | ||
"tslint": "^5.11.0", | ||
"tslint-config-standard": "^8.0.1", | ||
"typescript": "^3.0.3" | ||
}, | ||
"dependencies": { | ||
"@koa/cors": "^2.2.2", | ||
"aws-sdk": "^2.315.0", | ||
"class-validator": "^0.9.1", | ||
"googleapis": "^33.0.0", | ||
"graphql": "^14.0.0", | ||
"koa": "^2.5.2", | ||
"koa": "^2.5.3", | ||
"koa-bodyparser": "^4.2.1", | ||
"koa-helmet": "^4.0.0", | ||
"koa-jwt": "^3.5.1", | ||
"koa-router": "^7.4.0", | ||
"merge-graphql-schemas": "^1.5.3", | ||
"node-podcast-parser": "^2.3.0", | ||
"nodemon": "^1.18.4", | ||
"pg": "^7.4.3", | ||
"reflect-metadata": "^0.1.12", | ||
"pg-connection-string": "^2.0.0", | ||
"request": "^2.88.0", | ||
"shortid": "^2.2.13", | ||
"ts-node": "^7.0.1", | ||
"tsconfig-paths": "^3.5.0", | ||
"tslint": "^5.11.0", | ||
"tslint-config-standard": "^8.0.1", | ||
"tsconfig-paths": "^3.6.0", | ||
"typeorm": "^0.2.7", | ||
"typescript": "^3.0.3" | ||
"winston": "^3.1.0" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
import { ConnectionOptions } from 'typeorm' | ||
import * as dotenv from 'dotenv' | ||
|
||
const env = process.env | ||
dotenv.config({ path: '.env' }) | ||
|
||
export const awsConfig = { | ||
queueUrls: { | ||
feedsToParse: env.AWS_QUEUE_FEED_PARSER_URL, | ||
feedsToParseErrors: env.AWS_QUEUE_FEED_PARSER_ERRORS_URL | ||
}, | ||
region: env.AWS_REGION | ||
interface EntityRelationships { | ||
mediaRef: { | ||
mustHavePodcast: boolean | ||
mustHaveUser: boolean | ||
} | ||
} | ||
|
||
export const dbConfig = { | ||
database: 'postgres', | ||
host: env.DB_HOST || '0.0.0.0', | ||
log: { | ||
query: env.DB_LOG_QUERIES || true | ||
}, | ||
password: env.DB_PASSWORD || 'mysecretpw', | ||
port: env.DB_PORT || 5432, | ||
synchronize: env.DB_SYNCHRONIZE || true, | ||
type: 'postgres', | ||
username: env.DB_USERNAME || 'postgres' | ||
} as ConnectionOptions | ||
export interface IConfig { | ||
port: number | ||
debugLogging: boolean | ||
dbsslconn: boolean | ||
jwtSecret: string | ||
databaseUrl: string | ||
entityRelationships: EntityRelationships | ||
} | ||
|
||
export const entityRelationships = { | ||
mediaRef: { | ||
mustHavePodcast: env.MEDIA_REF_HAS_PODCAST || false, | ||
mustHaveUser: env.MEDIA_REF_HAS_USER || false | ||
const config: IConfig = { | ||
port: +process.env.PORT || 3000, | ||
debugLogging: process.env.NODE_ENV === 'development', | ||
dbsslconn: process.env.NODE_ENV !== 'development', | ||
jwtSecret: process.env.JWT_SECRET || 'your-secret-whatever', | ||
databaseUrl: process.env.DATABASE_URL || 'postgres://postgres:mysecretpw@localhost:5432/postgres', | ||
entityRelationships: { | ||
mediaRef: { | ||
mustHavePodcast: process.env.MEDIA_REF_HAS_PODCAST === 'true', | ||
mustHaveUser: process.env.MEDIA_REF_HAS_USER === 'true' | ||
} | ||
} | ||
} | ||
|
||
export { config } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { BaseContext } from 'koa' | ||
|
||
export default class GeneralController { | ||
|
||
public static async helloWorld (ctx: BaseContext) { | ||
ctx.body = 'Hellloooo world!' | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as general } from './general' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.