-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathapp.js
33 lines (25 loc) · 757 Bytes
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import express from 'express';
import path from 'path';
import favicon from 'serve-favicon';
import logger from 'morgan';
import cookieParser from 'cookie-parser';
import bodyParser from 'body-parser';
import cors from 'cors';
import {Schema} from "./data/schema";
import graphQLHTTP from "express-graphql";
const APP_PORT = process.env.PORT || 3000;
var app = express();
app.use(favicon(path.join(__dirname, 'favicon.ico')));
app.use(logger('dev'));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());
app.use(cors());
app.use('/', graphQLHTTP({
graphiql: true,
pretty: true,
schema: Schema,
}));
app.listen(APP_PORT, () => {
console.log(`App is now running on port: ${APP_PORT}`);
});