GraphQL Back-end Server with Relay, Koa, MongoDB and Mongoose
π§ WIP π§
Note See Front-end project graphql-relay-web
- Koa
- MongoDB
- Mongoose
- GraphQL
- Relay
- Jest
- SuperTest
- Code Coverage(Coverall) see
- Linter (Eslint)
- Prettier
.
βββ graphql/
β βββ schema.graphql
βββ script
βββ src/
β βββ __tests__
β βββ database
β βββ graphql
β βββ modules/
β β βββ event/
β β β βββ __tests__
β β β βββ fixure
β β β βββ mutations/
β β β β βββ __tests__
β β β β βββ EventCreateMutation.ts
β β β β βββ EventDeleteMutation.ts
β β β β βββ EventUpdateMutation.ts
β β β β βββ index.ts
β β β βββ EventFilterInputType.ts
β β β βββ EventLoader.ts
β β β βββ EventModel.ts
β β β βββ EventType.ts
β β βββ node/
β β βββ typeRegister.ts
β βββ schema/
β β βββ MutationType.ts
β β βββ QueryType.ts
β β βββ schema.ts
β βββ shared
βββ test
- clone this repo
# install dependencies
> yarn
# or
> yarn install
# copy .env file
> cp .env.example .env
# start project
> yarn start
# see on GraphiQL graphql interface on localhost link
http://localhost:9000/graphql
# or see graphql Playground
http://localhost:9000/playground
> yarn schema
> yarn seed
- π https://koa-server-production.up.railway.app/
- π https://koa-server-production.up.railway.app/graphql
- π https://koa-server-production.up.railway.app/playground
- Event Create Mutation
mutation {
EventCreate(
input: {
eventId: 564654
name: "nice event"
start: "2022-07-01T00:00:00.000Z"
end: "2022-07-01T23:59:59.000Z"
allDay: false
}
) {
event {
id
name
start
end
allDay
}
error
success
}
}
- Event delete Mutation
mutation {
EventDelete(input: { eventId: "629521641ff2c2c8f5f2e449" }) {
eventId
error
success
}
}
- Event Update Mutation
mutation {
EventUpdate(
input: {
eventId: "62952906f5c651ced019adf3"
name: "nice event /o/"
start: "2022-07-01T00:00:00.000Z"
end: "2022-07-01T23:59:59.000Z"
allDay: false
}
) {
event {
id
name
start
end
allDay
}
error
success
}
}
- Event queries
query {
events {
edges {
node {
name
start
end
allDay
}
}
}
}
Feel free to contribute to this project, if you find any bugs or improvements, open an issue and send a PR about it \o/