-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
34 lines (27 loc) · 970 Bytes
/
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
var express = require('express');
var app = require('express')();
var server = require('http').Server(app);
var bodyParser = require('body-parser');
var load = require('express-load');
const dotenv = require('dotenv');
dotenv.config();
var port = process.env.PORT;
app.use(express.static(__dirname + '/public'));
app.use(bodyParser({ limit: '250mb' }));
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }));
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', '*');
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
res.setHeader('Access-Control-Allow-Credentials', true);
next();
});
app.get('/check', function (req, res) {
res.json({ error: false })
})
load('routes')
.into(app);
server.listen(port, function () {
console.log('listening on *:' + port);
});