You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
444 B
15 lines
444 B
import type express from 'express';
|
|
import { join } from 'path';
|
|
import { default as _favicon } from 'serve-favicon';
|
|
|
|
export const favicon = _favicon(join('build', 'assets', 'favicon.ico'));
|
|
|
|
export function redirect(
|
|
req: express.Request,
|
|
res: express.Response,
|
|
next: Function,
|
|
) {
|
|
if (req.path.substr(-1) === '/' && req.path.length > 1)
|
|
res.redirect(301, req.path.slice(0, -1) + req.url.slice(req.path.length));
|
|
else next();
|
|
}
|
|
|