From e35f6f74ebe13acc2ff50cca5167b08f253c76f8 Mon Sep 17 00:00:00 2001 From: JJ Kasper Date: Fri, 1 Jun 2018 20:56:02 -0500 Subject: [PATCH] Fixed route changes not using getUrl causing invalid url to be used when using pathPrefix, renamed basePath to prefixPath, updated how getUrl gets the prefixPath to prevent the need for rebuilding when its changed now just requires restart --- .eslintrc.json | 3 +++ README.md | 8 +------- config/host.json | 3 +-- pages/_document.js | 7 ++++++- pages/index.js | 41 ++++++++++++++++++++++++++++------------- pages/k.js | 2 +- src/app.js | 23 +++++++++++++++-------- util/basePath.js | 8 -------- util/getUrl.js | 15 +++++++++------ util/pathPrefix.js | 8 ++++++++ util/stripBase.js | 8 -------- util/stripPrefix.js | 8 ++++++++ 12 files changed, 80 insertions(+), 54 deletions(-) delete mode 100644 util/basePath.js create mode 100644 util/pathPrefix.js delete mode 100644 util/stripBase.js create mode 100644 util/stripPrefix.js diff --git a/.eslintrc.json b/.eslintrc.json index 932a783..51fc6b5 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,4 +1,7 @@ { + "globals": { + "app": false + }, "parser": "babel-eslint", "plugins": [ "react" diff --git a/README.md b/README.md index bfc6a13..250f357 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ host.json | ---- | ----------- | | host | The host to listen on | | port | The port to listen on | -| basePath | Used to prefix all urls for reverse proxies | +| prefixPath | Used to prefix all urls for reverse proxies | production.json (overrides default.json with production NODE_ENV var) @@ -85,12 +85,6 @@ Lint both npm lint ``` -## Changelog - -__0.1.0__ - -- Initial release - ## License Copyright (c) 2017 diff --git a/config/host.json b/config/host.json index a424690..b9297cc 100644 --- a/config/host.json +++ b/config/host.json @@ -1,6 +1,5 @@ { "host": "localhost", "port": 3030, - "protocol": "http", - "basePath": "/" + "pathPrefix": "/" } \ No newline at end of file diff --git a/pages/_document.js b/pages/_document.js index 13ab210..ddeb8b2 100644 --- a/pages/_document.js +++ b/pages/_document.js @@ -3,7 +3,7 @@ import getUrl from '../util/getUrl' export default class MyDocument extends Document { render() { - const favicon = getUrl('favicon.ico') + const favicon = getUrl('favicon.icon') return ( @@ -16,6 +16,11 @@ export default class MyDocument extends Document { My Knowledge Base +