diff --git a/front/build/serverRequestsHandler.ts b/front/build/serverRequestsHandler.ts index 3a510e68..d031ba8d 100644 --- a/front/build/serverRequestsHandler.ts +++ b/front/build/serverRequestsHandler.ts @@ -1,18 +1,6 @@ - -// TODO add icon and refactor, change favicon serving -const urlsToSkip = [ - '/favicon.ico' -] - export default async function handler (ctx, renderer) { const { url } = ctx - // TODO add favicon skip favicon. - if (urlsToSkip.includes(url)) { - ctx.body = '' - return - } - try { ctx.response.header['Content-Type'] = 'text/html' ctx.body = await renderer.renderToString({ url }) diff --git a/front/package.json b/front/package.json index 8a2c6721..44cdb882 100644 --- a/front/package.json +++ b/front/package.json @@ -5,7 +5,7 @@ "private": true, "scripts": { "dev": "cross-env NODE_ENV=development nodemon", - "build": "cross-env NODE_ENV=production rimraf dist && npm run build:src && copyfiles index.html package.json dist/src && copyfiles package.json dist && tsc -p ./prod.tsconfig.json --outDir dist", + "build": "cross-env NODE_ENV=production rimraf dist && npm run build:src && copyfiles index.html package.json dist/src && copyfiles package.json dist && copyfiles ./static/* ./dist && tsc -p ./prod.tsconfig.json --outDir dist", "build:src": "concurrently \"npm run build:client\" \"npm run build:server\"", "build:client": "cross-env NODE_ENV=production webpack --config build/webpack.client.conf.js --hide-modules", "build:server": "cross-env NODE_ENV=production webpack --config build/webpack.server.conf.js --hide-modules", diff --git a/front/server.ts b/front/server.ts index 4f9a27d7..d0e6c189 100644 --- a/front/server.ts +++ b/front/server.ts @@ -1,5 +1,6 @@ import Koa from 'koa' import bodyparser from 'koa-bodyparser' +import koaStatic from 'koa-static' import proxy from 'koa-proxy' import DefferedPromise from './utils/DeferredPromise' import config from './config.js' @@ -21,6 +22,7 @@ export default (async () => { match: /^\/api\//, map: (path: string) => path.replace('/api', '') })) + app.use(koaStatic('./static')) app.use(bodyparser()) const setupServer = isProduction diff --git a/back/static/favicon.ico b/front/static/favicon.ico similarity index 100% rename from back/static/favicon.ico rename to front/static/favicon.ico