ecliptica/server/index.js

58 lines
1.5 KiB
JavaScript
Raw Normal View History

2023-08-01 13:14:02 +03:00
const express = require('express')
const bodyParser = require('body-parser')
const cookieParser = require('cookie-parser')
const session = require('express-session')
const app = express()
const cors = require('cors')
require('dotenv').config()
2024-10-16 11:06:23 +03:00
exports.app = app
2023-08-01 13:14:02 +03:00
const config = require('../.serverrc')
const { setIo } = require('./io')
app.use(cookieParser())
app.options('*', cors())
app.use(cors())
const server = setIo(app)
const sess = {
secret: 'super-secret-key',
resave: true,
saveUninitialized: true,
cookie: {
},
}
if (app.get('env') === 'production') {
app.set('trust proxy', 1)
sess.cookie.secure = true
}
app.use(session(sess))
app.use(bodyParser.json({
limit: '50mb',
}))
app.use(bodyParser.urlencoded({
limit: '50mb',
extended: true,
}))
app.use(require('./root'))
/**
* Добавляйте сюда свои routers.
*/
app.use('/kfu-m-24-1', require('./routers/kfu-m-24-1'))
2024-10-12 12:06:52 +03:00
app.use('/epja-2024-1', require('./routers/epja-2024-1'))
2024-10-16 11:06:23 +03:00
app.use('/todo', require('./routers/todo/routes'))
app.use('/dogsitters-finder', require('./routers/dogsitters-finder'))
app.use('/kazan-explore', require('./routers/kazan-explore'))
2024-12-07 09:55:00 +03:00
app.use('/edateam', require('./routers/edateam-legacy'))
2024-12-08 11:50:39 +03:00
app.use('/dry-wash', require('./routers/dry-wash'))
app.use('/freetracker', require('./routers/freetracker'))
2024-12-14 10:33:28 +03:00
app.use('/dhs-testing', require('./routers/dhs-testing'))
2023-08-01 13:14:02 +03:00
app.use(require('./error'))
server.listen(config.port, () => console.log(`Listening on http://localhost:${config.port}`))