I am new to Sails.js, and I'm pretty excited by it. It is a great tool for creating APIs. I am also working for a while with Yeoman generated single page apps (jquery or angular) and they are great for the client side logic.
However, currently the only way to make an app based on the two technologies is to separate them into two completely separate projects, which is wasteful.
I am looking for a way to combine the two. I want to make Sails.js serve the static assets of the web app and load its index.html file (instead of homepage.ejs). I also want the development environment (grunt, live-reload to work as it should).
I've tried creating a yeoman project inside the assets folder and redirecting the layout to the index.html but it has several issues: - I cannot separate between the app/ folder (during development) and the dist/ folder (in production) - the bower_components link is broken (it refers to /bower_components instead of /assets/app/bower_components)
I guess there might be more issues I haven't discovered yet.
Has anyone tried (and succeeded) combining these technologies?
You can serve the static index.html instead of homepage.ejs by doing the steps below:
'/': { view: 'homepage' }
to
'/': { view: false }
The assets folder serves as the root folder in the website. If your "angular.min.js" file is located in "assets\bower_components\angular" folder, this will be converted to "/bower_components/angular/angular.min.js" in the browser.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With