-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
29 lines (25 loc) · 843 Bytes
/
server.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
var express = require('express');
var app = express();
var express_graphql = require('express-graphql');
const schema = require('./schema/schema');
const log4js = require('log4js');
log4js.configure({
appenders: {
TestApp: { type: 'file', filename: 'logs/application.log' },
errorFile: { type: 'file', filename: 'logs/errors.log' },
errors: { type: 'logLevelFilter', level: 'error', appender: 'errorFile' }
},
categories: {
default: { appenders: ['TestApp', 'errors'], level: 'info' },
http: { appenders: ['TestApp'], level: 'info' }
}
});
app.use('/graphql', express_graphql({
schema: schema.schema,
rootValue: schema.root,
graphiql: true
}));
app.listen(4000);
console.log('Running a GraphQL API server at localhost:4000/graphql');
module.exports = app;
module.exports.express_graphql = express_graphql;