Running my Angularjs application on some server

Asked

Viewed 2,889 times

4

I have a front-end application consuming an Rails api, but I’m new to this idea of separating the front-end from the back-end, my api runs on localhost:3000, and my front is simply a folder that I go there manually and open my html page, i wanted to know how I run my front directly from the server ex: localhost:8000/front , if there is any way to play my front inside the Rails server on port 8080, or if I run on npm, I don’t want to use xammp or wamp,because when I deploy I don’t want to have a server for api and another for front, I want both on the same server but in different projects.

  • Do you have Python installed? Python has a module that creates a simple HTTP server for this type of test.

  • @Jéfersonbueno but that’s it , I want one that runs on the platform msm of Rails , if I run in python I will have to buy a server that supports python and Rails

  • I thought it was just for development.

  • Did you get an answer to your question?

  • Hello @durtto, so guy if you are going to use the angular 2 has the angular-cli take a look, in case the 1 used without same server.

  • If you got an answer, put it, so it can help other people.

Show 1 more comment

3 answers

3

You can use npm’s http-server

 npm install -g http-server 

Go to your angular application folder and type

http-server -a localhost -p 8000

0

You can have many servers running at the same time and for different Ips yet.

Example

rails s -p 8080 -b 0.0.0.0

-p = Port

-b = Bind Address

0

You can put your application on the Rails index page even as if it were a normal page.

On the Rails port, you can run the command rails server -p 8080.

More information about deploy is available here: Deployment Rails Applications - Caelum

Browser other questions tagged

You are not signed in. Login or sign up in order to post.