[Vuejs]-How can I separate out Express routes from server.js?

1👍

1) Inside of your ‘router.express.js’ file write: module.exports = router; at the bottom of the file.

2) Inside of your ‘server.js’ file write: const router = require('./router/express.router.js');
at the top of the file.

3) And now where you used to have app.use(require('./router/express.router.js'));
replace that with app.use(router);

4) At the top of ‘server.js’ write const vueSsrBundle = require('../../dist/vue-ssr-server-bundle.json')

5) Lastly replace renderer = createRenderer(require('../../dist/vue-ssr-server-bundle.json')
With renderer = createRenderer(vueSsrBundle)

EDIT the issue you are facing is on this line And probably related to the file ‘app.js’ or ‘client-entry-js’

Leave a comment