Browse Source

Remove connect-history-api-fallback

Moved to web hash history. It impacts SEO as per vue docs but irrelevant for this app
main
Haris Razis 4 years ago
parent
commit
01fdd503fe
  1. 8
      server/index.js
  2. 14
      server/package-lock.json
  3. 1
      server/package.json
  4. 2
      web/src/main.ts
  5. 4
      web/src/router/index.ts

8
server/index.js

@ -3,7 +3,6 @@ const server = require('http').createServer(app);
const bodyParser = require('body-parser'); const bodyParser = require('body-parser');
const chalk = require('chalk') const chalk = require('chalk')
const cors = require('cors') const cors = require('cors')
const history = require('connect-history-api-fallback');
const rateLimit = require('express-rate-limit'); const rateLimit = require('express-rate-limit');
require('./connections/mongo_conn'); require('./connections/mongo_conn');
@ -18,8 +17,7 @@ const {session_secret} = require('./config/keys');
app.use(cors( app.use(cors(
{ {
origin: ['http://localhost:8080'], origin: ['http://localhost:8080']
credentials: true
} }
)); ));
@ -46,9 +44,5 @@ app.use(dataRoute)
app.use(authRoute) app.use(authRoute)
app.use(athletesRoute) app.use(athletesRoute)
app.use(history({
verbose: true
}));
const PORT = process.env.PORT || 8000; const PORT = process.env.PORT || 8000;
server.listen(PORT, () => console.log(chalk.green.bold(`Server listening on port ${PORT}!`))); server.listen(PORT, () => console.log(chalk.green.bold(`Server listening on port ${PORT}!`)));

14
server/package-lock.json

@ -12,7 +12,6 @@
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"connect-history-api-fallback": "^1.6.0",
"cookie-session": "^1.4.0", "cookie-session": "^1.4.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"debug": "^2.6.9", "debug": "^2.6.9",
@ -560,14 +559,6 @@
"node": ">=8" "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": { "node_modules/console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",
@ -3256,11 +3247,6 @@
"xdg-basedir": "^4.0.0" "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": { "console-control-strings": {
"version": "1.1.0", "version": "1.1.0",
"resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz",

1
server/package.json

@ -14,7 +14,6 @@
"bcrypt": "^5.0.0", "bcrypt": "^5.0.0",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"connect-history-api-fallback": "^1.6.0",
"cookie-session": "^1.4.0", "cookie-session": "^1.4.0",
"cors": "^2.8.5", "cors": "^2.8.5",
"debug": "^2.6.9", "debug": "^2.6.9",

2
web/src/main.ts

@ -8,6 +8,6 @@ import 'bulma/css/bulma.css';
import '@fortawesome/fontawesome-free/css/all.css'; import '@fortawesome/fontawesome-free/css/all.css';
import '@fortawesome/fontawesome-free/js/all.js'; import '@fortawesome/fontawesome-free/js/all.js';
axios.defaults.baseURL = 'http://localhost:8000'; axios.defaults.baseURL = '/';
createApp(App).use(store).use(router).mount('#app') createApp(App).use(store).use(router).mount('#app')

4
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 Home from '../views/Home.vue'
import store from '../store/index' import store from '../store/index'
@ -24,7 +24,7 @@ const routes: Array<RouteRecordRaw> = [
] ]
const router = createRouter({ const router = createRouter({
history: createWebHistory(process.env.BASE_URL), history: createWebHashHistory(),
routes routes
}) })

Loading…
Cancel
Save