SHARE
TWEET

Untitled




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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.