2

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.

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

2 Comments

I came to the same conclusion, and kept this open just to see if there was another answer. You are right, this is the way to go.
Yes it´s probably the best option. At least until angular implement the angular universal in the angular-cli. Then it will be a plus to have a node server to serve the angular app already rendered.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.