mirror of
https://github.com/aelve/guide.git
synced 2024-11-22 03:12:58 +03:00
Serving favicon from front
This commit is contained in:
parent
72eab3bb42
commit
f97e3c35dc
@ -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 })
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
|
Before Width: | Height: | Size: 34 KiB After Width: | Height: | Size: 34 KiB |
Loading…
Reference in New Issue
Block a user