This file contains hidden or 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
| export const databaseInitializer = async () => { | |
| return await createConnection({ | |
| type : 'postgres', | |
| host : '0.0.0.0', | |
| port : 5432, | |
| username : 'db_user', | |
| password : 'db_password', | |
| database : 'db_name', | |
| entities: [ |
This file contains hidden or 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
| // | |
| // graphql/resolvers.ts | |
| // | |
| import { cardResolver } from 'graphql/resolvers/card'; | |
| import { cardsResolver } from 'graphql/resolvers/cards'; | |
| export const resolvers = { | |
| Query: { |
This file contains hidden or 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
| // | |
| // graphql/schema.ts | |
| // | |
| ... | |
| import { Mutation } from 'graphql/types/mutation'; | |
| ... | |
| const schemaDefinition = ` | |
| schema { |
This file contains hidden or 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
| // | |
| // graphql/types/card-patch.ts | |
| // | |
| export const CardPatch = ` | |
| input CardPatch { | |
| title : String | |
| description : String | |
| done : Boolean | |
| } |
This file contains hidden or 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
| import * as Koa from 'koa'; | |
| const app = new Koa(); | |
| app.use(async ctx => { | |
| ctx.body = "It works!\n"; | |
| }); | |
| app.listen(3000); |
This file contains hidden or 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
| import * as Koa from 'koa'; | |
| import { databaseInitializer } from 'initializers/database'; | |
| const bootstrap = async () => { | |
| await databaseInitializer(); | |
| const app = new Koa(); | |
| app.use(async ctx => { | |
| ctx.body = "It works!\n"; |
This file contains hidden or 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
| // | |
| // entities/card.ts | |
| // | |
| import { | |
| Entity, | |
| PrimaryGeneratedColumn, | |
| Column, | |
| CreateDateColumn, | |
| UpdateDateColumn, |
This file contains hidden or 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
| import * as Koa from 'koa'; | |
| import { databaseInitializer } from 'initializers/database'; | |
| import { routes } from 'routes'; | |
| const bootstrap = async () => { | |
| await databaseInitializer(); | |
| const app = new Koa(); | |
| app |
This file contains hidden or 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
| import * as Router from 'koa-router'; | |
| import * as koaBody from 'koa-bodyparser'; | |
| import { | |
| graphqlKoa, | |
| graphiqlKoa, | |
| } from 'apollo-server-koa'; | |
| import { schema } from 'graphql/schema'; |
This file contains hidden or 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
| import { makeExecutableSchema } from 'graphql-tools'; | |
| import { GraphQLSchema } from 'graphql'; | |
| import { Query } from 'graphql/types/query'; | |
| import { types } from 'graphql/types'; | |
| import { resolvers } from 'graphql/resolvers'; | |
| const schemaDefinition = ` |