-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
47 lines (35 loc) · 1.17 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
const Express = require('express')
const path = require('path')
const bodyparser = require('body-parser')
const Sequelize_Builder = require('./Generators/Sequelize')
const MongoDb_Builder = require('./Generators/MongoDb')
const app = Express()
app.use(bodyparser.urlencoded({limit: '200mb',extended:false}))
app.use(bodyparser.json())
app.use(Express.static(path.join(__dirname,"public")))
app.post("/gen",(req,res)=>{
if(req.body.type)
{
switch (req.body.type) {
case "sequelize": {
Sequelize_Builder(JSON.parse(req.body.Models), req.body.ID, req, res)
break
}
case "mongodb" : {
MongoDb_Builder(JSON.parse(req.body.Models), req.body.ID, req, res)
break
}
default : {
Sequelize_Builder(JSON.parse(req.body.Models), req.body.ID, req, res)
}
}
} else {
res.send("Internal Error")
}
});
app.get("/version",(req,res)=>{
res.json({version:'1.5.5'})
});
const http = require('http').Server(app);
const party = require('./party')(http)
http.listen((process.env.PORT || 25569))