1 | import express from 'express'; |
||
2 | import graphqlHTTP from 'express-graphql'; |
||
3 | import mongoose from 'mongoose'; |
||
4 | |||
5 | import schema from './graphql'; |
||
6 | |||
7 | var app = express(); |
||
8 | |||
9 | // GraphqQL server route |
||
10 | app.use('/graphql', graphqlHTTP(req => ({ |
||
0 ignored issues
–
show
|
|||
11 | schema, |
||
12 | pretty: true, |
||
13 | graphiql: true |
||
14 | }))); |
||
15 | |||
16 | // Connect mongo database |
||
17 | mongoose.connect('mongodb://localhost/graphql'); |
||
18 | |||
19 | // start server |
||
20 | let server = app.listen(4000, function () { |
||
21 | var host = server.address().address; |
||
22 | var port = server.address().port; |
||
23 | |||
24 | console.log('GraphQL listening at http://%s:%s', host, port); |
||
0 ignored issues
–
show
|
|||
25 | }); |
||
26 | |||
27 | export default server; |
||
28 |
This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.