-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
35 lines (26 loc) · 913 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
30
31
32
33
34
35
const express = require('express');
const {mongoose} = require('./db/mongose');
const bodyParser = require('body-parser');
const AuthRoutes = require('./routes/auth');
const TodoRoutes = require('./routes/todo');
const MonitorRoutes = require('./routes/monitor');
// register events
const {Event} = require('./app/classes/events');
// import graphql
const graphqlHttp = require('express-graphql');
const graphqlSchema = require('./graphql/schema');
const graphqlResolvers = require('./graphql/resolvers');
let app = express();
app.use(bodyParser.json());
app.use('/auth', AuthRoutes);
app.use('/todos', TodoRoutes);
app.use('/monitor' , MonitorRoutes);
app.use('/graphql',graphqlHttp({
schema: graphqlSchema,
rootValue: graphqlResolvers,
graphiql: true
}))
// create an api for managing errors for api calls thats are never found
app.listen(3000,(resp)=>{
console.log("server running")
})