Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Serving favicon from front #416

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions front/build/serverRequestsHandler.ts
Original file line number Diff line number Diff line change
@@ -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 })
Expand Down
2 changes: 1 addition & 1 deletion front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions front/server.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand All @@ -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
Expand Down
File renamed without changes.