Project Initialization

Getting Started

We take advantage of the vue-cli to initialize the project.

$ npm install -g vue-cli
$ vue init xpepermint/vue-cli-template {my-project}
$ cd {my-project}
$ npm install

This will initialize a new Vue.js application with support for server-side rendering and hot module reload in development.

You can now start the HTTP server.

$ npm run start

Development

It is highly recommended to use Nodemon in development. It will restart you application when the server-side code changes (client-side changes are already handled by the application itself).

Install the required package.

$ npm install -g nodemon

Run the command below to start the server.

$ nodemon --exec npm start

Production

When you are ready to push your code in production, compile the project into the ./dist directory and set at least the env environment variable (check the ./config/index.js).

$ npm run build
$ npm config set {my-project}:env production

Serving static files through Node.js in production could slow down your application. It is recommended that you move the entire ./public directory to CDN or you serve these files through Nginx or similar HTTP server. The ./dist/client bundles are also served as public files thus don't forget to move them as well. In this case you'll need to configure the publicPath configuration variable.

$ npm config set {my-project}:publicPath https://{cdn-path}

Run the command below to start the server.

$ npm start

results matching ""

    No results matching ""