Skip to content

Tarrask/sails-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 

Repository files navigation

Nuxt.js with Sails

SailsJS + Nuxt.js = ⚡

Installation

This is a project template for vue-cli.

vue init tarrask/sails-template <project-name>
cd <project-name> # move to your project
npm install # or yarn install*[see note below]

Make sure to use a version of vue-cli >= 2.1 (vue -V).

If you are using vue-cli >= 3.0, you have to install a global bridge:

npm install -g @vue/cli-init

*Note: Due to a bug in yarn's engine version detection code if you are using a prerelease version of Node (i.e. v7.6.0-rc.1) you will need to either:

  1. Use npm install
  2. Run yarn with a standard release of Node and then switch back

Commands

Command Description
npm run dev Lift sails server in development with Nuxt.js in dev mode (hot reloading). Listen on http:https://localhost:1337.
npm run build Build the nuxt.js web application for production.
npm start Start sails server in production.

Configuration

The nuxt.config.js is located in the config/nuxt.js to follow sails convention and to use it from a sails hook.

To access the sails backend from nuxt, you can use the axios. It is preconfigured by the hook to point to the sails port. For it to work from the client, you may need to add proxy: true to nuxt.js

module.exports.nuxt = {
  modules: [ '@nuxtjs/axios' ],
  axios: {
    proxy: true
  }
}

Documentation

Links

Licenses