1
1
mirror of https://github.com/aelve/guide.git synced 2024-11-22 11:33:34 +03:00

Serving favicon from front

This commit is contained in:
avele 2019-11-13 16:53:03 +04:00
parent 72eab3bb42
commit f97e3c35dc
4 changed files with 3 additions and 13 deletions

View File

@ -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 })

View File

@ -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",

View File

@ -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

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB