Jeff
Jeff

Reputation: 4433

Serve angular 2 CLI from sails.js

I read through this blog post and was successfully able to get the "hello world" page to run. I couldn't figure out routing, so I decided to generate an entire angular 2 CLI app and stick it in my assets folder.

Is there a way to tell sails to route all calls to /admin to that angular app? Also, if there is a better way to do this, all I am trying to do is create an angular 2 admin app for a sails api.

Upvotes: 2

Views: 345

Answers (1)

adrianolsk
adrianolsk

Reputation: 332

I recommend you use the 2 tier aproach. And host your angular app in one place and the sails api on another.

For example you can ng build --prod take all the files from the dist folder and host in a static file server, like Amazon S3.

And host your sails.js api in some cloud server like Digital Ocean, Amazon, Azure, Heroku, Google or any other that suports node.

Since the angular don't need nothing from the server to run it can be anywhere and point to the api to get the data.

Upvotes: 3

Related Questions