Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(async () => {
await app.prepare();
const server = express();
server.use(nextI18NextMiddleware(nextI18next));
server.get('*', (req, res) => handle(req, res));
await server.listen(port);
console.log(`> Ready on http://localhost:${port}`); // eslint-disable-line no-console
})();
(async () => {
await app.prepare();
const server = express();
server.use(nextI18NextMiddleware(nextI18next));
server.get('*', (req, res) => handle(req, res));
await server.listen(port);
console.log(`> Ready on http://localhost:${port}`); // eslint-disable-line no-console
})();
(async () => {
await app.prepare()
const server = express()
server.use(nextI18NextMiddleware(nextI18next))
server.get('*', (req, res) => handle(req, res))
await server.listen(port)
console.log(`> Ready on http://localhost:${port}`) // eslint-disable-line no-console
})()
const api_pokemon = require('./api/pokemon');
const route_pokemons = require('./routes/pokemons');
const route_search = require('./routes/search');
/**
* Necessary headers & middlewares
*/
server.use(helmet());
server.use(compression());
server.use(cookieParser());
/**
* next-i18next middleware
*/
server.use(nextI18NextMiddleware(nextI18next));
/**
* DEFINE CACHE
* serve static file with cache, for locales file: 1d, others are 30d
*/
const staticPath = path.join(__dirname, '../../public/static');
server.use(
'/static/locales',
express.static(staticPath + '/locales', {
maxAge: '1h'
})
);
server.use(
'/static',
express.static(staticPath, {
maxAge: '30d',
(async () => {
await app.prepare();
const server = express();
server.use(nextI18NextMiddleware(nextI18next));
server.use((request, response) => {
const parsedUrl = parse(request.url, true);
const { pathname } = parsedUrl;
if (pathname === '/service-worker.js') {
const filePath = join(__dirname, '.next', pathname);
return app.serveStatic(request, response, filePath);
}
return handle(request, response, pathname);
});
server.get('*', (req, res) => handle(req, res));
await server.listen(port);
(async () => {
await app.prepare();
const server = express();
server.use(nextI18NextMiddleware(nextI18next));
server.use('/static', express.static('static'));
server.get('*', (req, res) => handle(req, res));
await server.listen(port);
signale.success(`<> Ready on localhost:${port}`);
})();