/var/www/qr4y.com/server/delivery
Edit: /var/www/qr4y.com/server/delivery/index.js (1109B)
const config = require('./config/app.json')
require('./data/errors/index')
require('./var')
require('./func')
const express = require('express')
const app = express()
app.use(function(req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.header("Access-Control-Allow-Headers", "Content-Type");
res.header("Access-Control-Allow-Methods", "PUT, GET, POST, DELETE, OPTIONS");
next();
});
const router = express.Router()
const { createServer } = require('http')
const httpServer = createServer(app)
const port = config.api.port || 3000
const db = require('./models/index')
global.SERVICES = require('./services')({ db, config, httpServer })
Promise.all([
SERVICES.AuthService.Run(),
SERVICES.MailService.Run(),
SERVICES.WorldService.Run(),
SERVICES.BranchService.Run(),
SERVICES.OrderService.Run(),
SERVICES.WebSocketService.Run(),
]).then(()=>{
require('./api/routes/index')({ app, db, router})
httpServer.listen(port, () => {
console.log(`Listen port ${port}`)
})
}).catch(error=>{
console.error(error)
})