From 01fdd503fe566d304f52f18d39606025455466e2 Mon Sep 17 00:00:00 2001 From: Haris Razis Date: Tue, 5 Jan 2021 10:29:45 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9D=8C=20Remove=20connect-history-api-fallba?= =?UTF-8?q?ck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moved to web hash history. It impacts SEO as per vue docs but irrelevant for this app --- server/index.js | 8 +------- server/package-lock.json | 14 -------------- server/package.json | 1 - web/src/main.ts | 2 +- web/src/router/index.ts | 4 ++-- 5 files changed, 4 insertions(+), 25 deletions(-) diff --git a/server/index.js b/server/index.js index 5db37cb..43afed5 100644 --- a/server/index.js +++ b/server/index.js @@ -3,7 +3,6 @@ const server = require('http').createServer(app); const bodyParser = require('body-parser'); const chalk = require('chalk') const cors = require('cors') -const history = require('connect-history-api-fallback'); const rateLimit = require('express-rate-limit'); require('./connections/mongo_conn'); @@ -18,8 +17,7 @@ const {session_secret} = require('./config/keys'); app.use(cors( { - origin: ['http://localhost:8080'], - credentials: true + origin: ['http://localhost:8080'] } )); @@ -46,9 +44,5 @@ app.use(dataRoute) app.use(authRoute) app.use(athletesRoute) -app.use(history({ - verbose: true -})); - const PORT = process.env.PORT || 8000; server.listen(PORT, () => console.log(chalk.green.bold(`Server listening on port ${PORT}!`))); diff --git a/server/package-lock.json b/server/package-lock.json index c814821..3eeed70 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -12,7 +12,6 @@ "bcrypt": "^5.0.0", "body-parser": "^1.19.0", "chalk": "^4.1.0", - "connect-history-api-fallback": "^1.6.0", "cookie-session": "^1.4.0", "cors": "^2.8.5", "debug": "^2.6.9", @@ -560,14 +559,6 @@ "node": ">=8" } }, - "node_modules/connect-history-api-fallback": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", - "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==", - "engines": { - "node": ">=0.8" - } - }, "node_modules/console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", @@ -3256,11 +3247,6 @@ "xdg-basedir": "^4.0.0" } }, - "connect-history-api-fallback": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/connect-history-api-fallback/-/connect-history-api-fallback-1.6.0.tgz", - "integrity": "sha512-e54B99q/OUoH64zYYRf3HBP5z24G38h5D3qXu23JGRoigpX5Ss4r9ZnDk3g0Z8uQC2x2lPaJ+UlWBc1ZWBWdLg==" - }, "console-control-strings": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", diff --git a/server/package.json b/server/package.json index 615a269..8fe15c5 100644 --- a/server/package.json +++ b/server/package.json @@ -14,7 +14,6 @@ "bcrypt": "^5.0.0", "body-parser": "^1.19.0", "chalk": "^4.1.0", - "connect-history-api-fallback": "^1.6.0", "cookie-session": "^1.4.0", "cors": "^2.8.5", "debug": "^2.6.9", diff --git a/web/src/main.ts b/web/src/main.ts index 88e3751..ba4f72b 100644 --- a/web/src/main.ts +++ b/web/src/main.ts @@ -8,6 +8,6 @@ import 'bulma/css/bulma.css'; import '@fortawesome/fontawesome-free/css/all.css'; import '@fortawesome/fontawesome-free/js/all.js'; -axios.defaults.baseURL = 'http://localhost:8000'; +axios.defaults.baseURL = '/'; createApp(App).use(store).use(router).mount('#app') diff --git a/web/src/router/index.ts b/web/src/router/index.ts index 3a0249d..0d6aa45 100644 --- a/web/src/router/index.ts +++ b/web/src/router/index.ts @@ -1,4 +1,4 @@ -import {createRouter, createWebHistory, RouteRecordRaw} from 'vue-router' +import {createRouter, createWebHashHistory, RouteRecordRaw} from 'vue-router' import Home from '../views/Home.vue' import store from '../store/index' @@ -24,7 +24,7 @@ const routes: Array = [ ] const router = createRouter({ - history: createWebHistory(process.env.BASE_URL), + history: createWebHashHistory(), routes })