venmjs
Version:
This is a tool 🔧 that can be installed in your terminal at any time ⛏️ it was made for beginners and even for experts, for his utilities, and for a simple creation process 🧨. Every web developer knows how frustrating is to deal with the creation of a ne
37 lines (29 loc) • 741 B
JavaScript
import express from 'express'
import bodyParser from 'body-parser'
import { graphiqlExpress, graphqlExpress } from 'graphql-server-express'
import { makeExecutableSchema } from 'graphql-tools'
import typeDefs from './schema'
import resolvers from './resolvers'
import models from './models'
export const schema = makeExecutableSchema({
typeDefs,
resolvers,
})
const app = express()
app.use(
'/graphiql',
graphiqlExpress({
endpointURL: '/graphql',
})
)
app.use(
'/graphql',
bodyParser.json(),
graphqlExpress({
schema,
context: {
models,
},
})
)
models.sequelize.sync().then(() => app.listen(5600, () => console.log('Server is running at the port 5600')))