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() exports.app = app 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('/epja-2024-1', require('./routers/epja-2024-1')) app.use('/todo', require('./routers/todo/routes')) app.use('/dogsitters-finder', require('./routers/dogsitters-finder')) app.use(require('./error')) server.listen(config.port, () => console.log(`Listening on http://localhost:${config.port}`))