Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
secret: process.env.SESSION_SECRET,
maxAge: 7 * 24 * 60 * 60 * 1000,
secureProxy: true
}));
app.use(cookieParser());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({
extended: true
}));
const dbInfo = require('./database')();
require('./swagger')(app, cors);
app.use('/api/docs', cors(), express.static('./node_modules/swagger-ui-dist'));
app.use(swStats.getMiddleware({
swaggerSpec: require('../swagger'),
apdexThreshold: 250,
authentication: true,
onAuthenticate: (req, username, password) => {
return username.toLowerCase() == process.env.USERNAME.toLowerCase() && password == process.env.PASSWORD
}
}));
app.use(postgraphile(dbInfo.connectionString, 'public', {
disableDefaultMutations: true,
graphiql: true
}));
let corsConfig = cors(corsOptions);
require('../app/coach/coach.route')(app, dbInfo.db, corsConfig);
require('../app/game/game.route')(app, dbInfo.db, corsConfig, speedLimiter);
beforeNext: async server => {
const app = new serverApp.DofapiApplication();
await app.boot();
server.use(swStats.getMiddleware({ swaggerSpec: apiSpec }));
server.use('/', app.requestHandler);
},
});
const Koa = require('koa');
const bodyParser = require('koa-bodyparser');
const cors = require('@koa/cors');
const swStats = require('swagger-stats');
const e2k = require('express-to-koa');
const fx = require('./fx');
const app = new Koa();
app.use(e2k(swStats.getMiddleware({})));
app.use(cors({
origin: '*',
}));
app.use(bodyParser());
app.use(fx);
app.listen(3000);