AngularJS + sails.js

前端 未结 5 1312
有刺的猬
有刺的猬 2020-12-07 08:12

I am developing an app that can utilize sails.js for back-end and AngularJS for Front-end. I thought that I\'ll create an Angular App using Yeoman-angular generator https://

5条回答
  •  生来不讨喜
    2020-12-07 08:49

    I have got similar use case as yours. I used Yeoman to generate the project structure for angularjs. In this situation, my solution is:

    1. Use 'grunt serve' to generate the angularjs single page app into minified version and everything should under 'dist' folder.
    2. In the routes.js in sails.js project, remove the configuration code for views:

      '/': { view: 'homepage' }

    3. Remove all the files under sails.js views and assets folder. But please just make sure you don't need any file in assets folder before you remove everything.

    4. Copy and paste the minified angularjs website to assets folder.

    5. Start sails.js (sails lift) and you can browse your angular website at localhost:1337

    Sails.js now also have briefly mentioned this method http://sailsjs.org/documentation/concepts/views

提交回复
热议问题