Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import express from 'express'
- import path from 'path'
- import chalk from 'chalk'
- import bodyParser from 'body-parser'
- import { graphqlExpress } from 'apollo-server-express'
- import schema from './graphql/schema'
- import config from './config'
- const app = express()
- app.use('/', express.static(path.resolve(__dirname, '/../public')))
- app.get('/', (req, res) => {
- res.send({
- message: 'Hi Shiv, To get access please find the credentials with given query'
- })
- })
- app.use('/graphql', bodyParser.json(), graphqlExpress({
- schema
- }))
- app.listen(config.PORT, () => {
- const log = console.log
- log('\n')
- log(chalk.bgGreen.black(`Server listening on http://localhost:${config.PORT}/ ..`))
- log('\n')
- log(`${chalk.blue('/graphql')} - endpoint for queries`)
- log('\n')
- })
- export default app
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement