-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit fe484ac
Showing
15 changed files
with
2,827 additions
and
0 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 @@ | ||
PORT=4000 |
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,22 @@ | ||
{ | ||
"env": { | ||
"node": true, | ||
"amd": true, | ||
"es6": true | ||
}, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/eslint-recommended" | ||
], | ||
"globals": { | ||
"Atomics": "readonly", | ||
"SharedArrayBuffer": "readonly" | ||
}, | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"ecmaVersion": 2018, | ||
"sourceType": "module" | ||
}, | ||
"plugins": ["@typescript-eslint"], | ||
"rules": {} | ||
} |
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 @@ | ||
node_modules | ||
dist | ||
yarn-error.log | ||
.env |
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,6 @@ | ||
{ | ||
"semi": false, | ||
"singleQuote": true, | ||
"no-func-assign": false, | ||
"proseWrap": "always" | ||
} |
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,3 @@ | ||
# TypeScript GraphQL Starter π | ||
|
||
Get Started Real Fast! |
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,30 @@ | ||
{ | ||
"name": "typescript-graphql-starter", | ||
"version": "1.0.0", | ||
"main": "src/index.ts", | ||
"repository": "[email protected]:blutarche/typescript-graphql-starter.git", | ||
"author": "Aikdanai Sidhikosol <[email protected]>", | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"dev": "ts-node-dev --no-notify --respawn --transpileOnly -r dotenv/config ./src/index" | ||
}, | ||
"dependencies": { | ||
"apollo-server": "2.10.1", | ||
"graphql": "14.6.0", | ||
"graphql-iso-date": "3.6.1", | ||
"graphql-type-json": "0.3.1", | ||
"lodash": "4.17.15", | ||
"nexus": "0.12.0-rc.13" | ||
}, | ||
"devDependencies": { | ||
"@types/lodash": "4.14.149", | ||
"@types/node": "13.7.6", | ||
"@typescript-eslint/eslint-plugin": "2.21.0", | ||
"@typescript-eslint/parser": "2.21.0", | ||
"dotenv": "8.2.0", | ||
"eslint": "6.8.0", | ||
"ts-node-dev": "1.0.0-pre.44", | ||
"typescript": "3.8.2" | ||
} | ||
} |
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,104 @@ | ||
/** | ||
* This file was automatically generated by GraphQL Nexus | ||
* Do not make changes to this file directly | ||
*/ | ||
|
||
|
||
import { core } from "nexus" | ||
declare global { | ||
interface NexusGenCustomInputMethods<TypeName extends string> { | ||
date<FieldName extends string>(fieldName: FieldName, opts?: core.ScalarInputFieldConfig<core.GetGen3<"inputTypes", TypeName, FieldName>>): void // "DateTime"; | ||
jsonObject<FieldName extends string>(fieldName: FieldName, opts?: core.ScalarInputFieldConfig<core.GetGen3<"inputTypes", TypeName, FieldName>>): void // "JSONObject"; | ||
json<FieldName extends string>(fieldName: FieldName, opts?: core.ScalarInputFieldConfig<core.GetGen3<"inputTypes", TypeName, FieldName>>): void // "JSON"; | ||
} | ||
} | ||
declare global { | ||
interface NexusGenCustomOutputMethods<TypeName extends string> { | ||
date<FieldName extends string>(fieldName: FieldName, ...opts: core.ScalarOutSpread<TypeName, FieldName>): void // "DateTime"; | ||
jsonObject<FieldName extends string>(fieldName: FieldName, ...opts: core.ScalarOutSpread<TypeName, FieldName>): void // "JSONObject"; | ||
json<FieldName extends string>(fieldName: FieldName, ...opts: core.ScalarOutSpread<TypeName, FieldName>): void // "JSON"; | ||
} | ||
} | ||
|
||
|
||
declare global { | ||
interface NexusGen extends NexusGenTypes {} | ||
} | ||
|
||
export interface NexusGenInputs { | ||
} | ||
|
||
export interface NexusGenEnums { | ||
} | ||
|
||
export interface NexusGenRootTypes { | ||
Query: {}; | ||
String: string; | ||
Int: number; | ||
Float: number; | ||
Boolean: boolean; | ||
ID: string; | ||
DateTime: any; | ||
JSON: any; | ||
JSONObject: any; | ||
} | ||
|
||
export interface NexusGenAllTypes extends NexusGenRootTypes { | ||
} | ||
|
||
export interface NexusGenFieldTypes { | ||
Query: { // field return type | ||
ok: boolean; // Boolean! | ||
} | ||
} | ||
|
||
export interface NexusGenArgTypes { | ||
} | ||
|
||
export interface NexusGenAbstractResolveReturnTypes { | ||
} | ||
|
||
export interface NexusGenInheritedFields {} | ||
|
||
export type NexusGenObjectNames = "Query"; | ||
|
||
export type NexusGenInputNames = never; | ||
|
||
export type NexusGenEnumNames = never; | ||
|
||
export type NexusGenInterfaceNames = never; | ||
|
||
export type NexusGenScalarNames = "Boolean" | "DateTime" | "Float" | "ID" | "Int" | "JSON" | "JSONObject" | "String"; | ||
|
||
export type NexusGenUnionNames = never; | ||
|
||
export interface NexusGenTypes { | ||
context: any; | ||
inputTypes: NexusGenInputs; | ||
rootTypes: NexusGenRootTypes; | ||
argTypes: NexusGenArgTypes; | ||
fieldTypes: NexusGenFieldTypes; | ||
allTypes: NexusGenAllTypes; | ||
inheritedFields: NexusGenInheritedFields; | ||
objectNames: NexusGenObjectNames; | ||
inputNames: NexusGenInputNames; | ||
enumNames: NexusGenEnumNames; | ||
interfaceNames: NexusGenInterfaceNames; | ||
scalarNames: NexusGenScalarNames; | ||
unionNames: NexusGenUnionNames; | ||
allInputTypes: NexusGenTypes['inputNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['scalarNames']; | ||
allOutputTypes: NexusGenTypes['objectNames'] | NexusGenTypes['enumNames'] | NexusGenTypes['unionNames'] | NexusGenTypes['interfaceNames'] | NexusGenTypes['scalarNames']; | ||
allNamedTypes: NexusGenTypes['allInputTypes'] | NexusGenTypes['allOutputTypes'] | ||
abstractTypes: NexusGenTypes['interfaceNames'] | NexusGenTypes['unionNames']; | ||
abstractResolveReturn: NexusGenAbstractResolveReturnTypes; | ||
} | ||
|
||
|
||
declare global { | ||
interface NexusGenPluginTypeConfig<TypeName extends string> { | ||
} | ||
interface NexusGenPluginFieldConfig<TypeName extends string, FieldName extends string> { | ||
} | ||
interface NexusGenPluginSchemaConfig { | ||
} | ||
} |
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,24 @@ | ||
### This file was autogenerated by GraphQL Nexus | ||
### Do not make changes to this file directly | ||
|
||
|
||
""" | ||
A date-time string at UTC, such as 2007-12-03T10:15:30Z, compliant with the | ||
`date-time` format outlined in section 5.6 of the RFC 3339 profile of the ISO | ||
8601 standard for representation of dates and times using the Gregorian calendar. | ||
""" | ||
scalar DateTime | ||
|
||
""" | ||
The `JSON` scalar type represents JSON values as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). | ||
""" | ||
scalar JSON | ||
|
||
""" | ||
The `JSONObject` scalar type represents JSON objects as specified by [ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf). | ||
""" | ||
scalar JSONObject | ||
|
||
type Query { | ||
ok: Boolean! | ||
} |
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 * from './scalar' |
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,7 @@ | ||
import { asNexusMethod } from 'nexus' | ||
import { GraphQLDateTime } from 'graphql-iso-date' | ||
import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json' | ||
|
||
export const DateScalar = asNexusMethod(GraphQLDateTime, 'date') | ||
export const JSONObjectScalar = asNexusMethod(GraphQLJSONObject, 'jsonObject') | ||
export const JSONScalar = asNexusMethod(GraphQLJSON, 'json') |
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,20 @@ | ||
import { ApolloServer } from 'apollo-server' | ||
|
||
import { schema } from './schema' | ||
|
||
export const apolloConfig = { | ||
schema, | ||
playground: true, | ||
introspection: true, | ||
context: ({ req }) => { | ||
return { | ||
headers: req.headers | ||
} | ||
} | ||
} | ||
|
||
const server = new ApolloServer(apolloConfig) | ||
const port = process.env.PORT || 4000 | ||
server.listen({ port }).then(({ url }) => { | ||
console.log(`π Server ready at ${url}`) | ||
}) |
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,15 @@ | ||
import { makeSchema } from 'nexus' | ||
import path from 'path' | ||
import * as graphQLTypes from './graphql' | ||
|
||
export const schema = makeSchema({ | ||
types: graphQLTypes, | ||
outputs: { | ||
schema: path.join(__dirname, './generated/schema.graphql'), | ||
typegen: path.join(__dirname, './generated/generated-types.d.ts') | ||
}, | ||
nonNullDefaults: { | ||
input: false, | ||
output: false | ||
} | ||
}) |
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,3 @@ | ||
interface Context { | ||
providerId: string | ||
} |
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,18 @@ | ||
{ | ||
"compilerOptions": { | ||
"module": "commonjs", | ||
"esModuleInterop": true, | ||
"target": "es2019", | ||
"noImplicitAny": false, | ||
"moduleResolution": "node", | ||
"sourceMap": true, | ||
"outDir": "dist", | ||
"baseUrl": "src", | ||
"paths": { | ||
"*": ["node_modules/*", "src/@types/*"] | ||
}, | ||
"types": ["node"] | ||
}, | ||
"include": ["src/**/*"], | ||
"exclude": ["node_modules"] | ||
} |
Oops, something went wrong.