Serving a vue build's bundle.js to users with a custom JS server application

I am hoping to use VUE to build a simulation environment’s user interface.
I have a server application which acts as a middle man between the user and the simulation engine.
The server will connect to the engine, deliver commands to it on behalf of the user, and pipe data received from the engine to the user. It will also handle subscription permissions for each data channel.

The idea I have is the simply bundle up the entire client-side of things into the bundle.js and then deliver that to the user whenever they reach the url I’m serving the /dist/ folder at.

My question is… because I’m serving a vue application with a custom server I’ve written for myself, will this slow down the delivery of the client interface or data? Will it make the vue router not work? In other words, since I’m not using the vue-cli here to serve the app, what will I have to make up for? What does the Vue-cli do that allows the vue build to work properly that I will undoubtedly be missing out on if I don’t use the vue-cli to serve the app?

Since I want to handle multiple users and handle permissions of the users to see/send data down certain channels, store passwords and usernames, evaluate whether I want to log some set of data before I send it to the user (etc)… I assume I can’t get away from having to use my own custom written server application that processes all of that for the user. Am I wrong about that? How might I work around that?

Hi

You can definitivly serve your vue app´s index.html and js files from a server written by yourself. I don’t know which platform you uses so I can’t give an example but it is like serving any other file and isn’t slower than this. In order for the vue router to work in history mode you must rewrite all incoming requests which can be a valid adress in your application to deliver the index.html

So for example if a user asks for http://myserver.com/ should he/she get the index.html file. But If the user asks for http://myserver.com/another-page should he/she still get index.html Otherwise will a user going to the other-page from the beginning or reloading the page get a error that the page doesn’t exist.

@johandalabacka

Thank you for your reply.

Someone told me that there are several different COTS servers like http-server or apache. But they also said not to use http-server for production because it is very slow. I assume Apache is quite fast because people seem to use that a lot. What is the difference between a server that is considered not fit for production and another that is?

Could you link to a video that elaborates on the vue-router thing you are trying to explain? I’ve never used the vue-router so I’m unclear on the message you are trying to get across.

The two big webservers is Apache and nginx. Then nginx came out it was much faster than Apache but had less features and plugins. But they have both changed since then. If you write your own webserver in node, python, go etc it is fairly common to use nginx as a proxy in the front. It delivers all static files, images , static webpages and forwards all relevant traffic to your own written server (but you can use Apache for this also)

I have no video but this page shows configuration for both Apache, nginx and own written servers https://router.vuejs.org/guide/essentials/history-mode.html#example-server-configurations