-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (44 loc) · 1.32 KB
/
index.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const express = require('express');
const GraphHTTP = require('express-graphql');
const Schema = require('./schema');
const models = require("./models");
const port = 9876;
const app = express();
app.use('/graphql', GraphHTTP({
schema: Schema,
pretty: true,
graphiql: true
}));
models.sequelize
.sync({ force: true })
.then(function (err) {
app.listen(port, function () {
console.log('[SUCCESS] Express server listening on port ' + port + "\n\n");
});
// @TODO: Remove this
models.user.create({
memId: 1234,
name : 'Shreyansh',
email : '[email protected]',
type : 2,
status : 1
}).then(u1 => {
models.user.create({
memId: 4567,
name : 'Ekam',
email : '[email protected]',
type : 2,
status : 1
}).then(u2=>{
models.tutorial.create({
title : 'abd',
body : 'Tuto1',
status : 1,
created_by : u1.memId,
modified_by : u2.memId
});
});
});
}, function (err) {
console.log('An error occurred while creating the table:', err);
});