Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
app.prepare().then(() => {
const server = express();
app.setAssetPrefix(process.env.STATIC_PATH);
server.use(express.static(path.join(__dirname, "../static")));
server.use(nextI18NextMiddleware(nextI18next));
if (process.env.PROXY_MODE === "local") {
// eslint-disable-next-line global-require
const proxyMiddleware = require("http-proxy-middleware");
Object.keys(devProxy).forEach(context => {
server.use(proxyMiddleware(context, devProxy[context]));
});
}
server.get("*", (req, res) => handler(req, res));
server.listen(port);
// eslint-disable-next-line no-console
console.log(
`> Server listening at http://localhost:${port} as ${
})
server.get('/connect', (_, res) => {
res.redirect('/community')
})
server.get('/tos', (_, res) => {
res.redirect('/user-agreement')
})
server.get('/stake-off', (_, res) => {
res.redirect('https://forum.celo.org/t/the-great-celo-stake-off-the-details/136')
})
server.use(bodyParser.json())
server.use(nextI18NextMiddleware(nextI18next))
server.post('/fellowship', async (req, res) => {
const { ideas, email, name, bio, deliverables, resume } = req.body
try {
const fellow = await submitFellowApp({
name,
email,
ideas,
bio,
deliverables,
resume,
})
res.status(204).json({ id: fellow.id })
} catch (e) {
Sentry.withScope((scope) => {