Running my AngularJS application on some server

3

I have a front end application consuming an api rails, 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-end server from the ex: localhost: 8000 / front, if it has some way to throw my front inside the rails server on port 8080, or if I run on npm, I I do not want to use xammp or wamp, so when I do deploy I do not want to have one server for api and another for the front, I want both on the same server but on different projects.

    
asked by anonymous 25.09.2015 / 14:02

3 answers

3

You can use npm's http-server

 npm install -g http-server 

Go to your application folder and type

http-server -a localhost -p 8000
    
25.09.2015 / 14:28
0

You can put your application on the same Rails index page as a regular page.

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

There is more information on deploy here: Deployment Rails Applications - Caelum

    
25.09.2015 / 14:08
0

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

Example

rails s -p 8080 -b 0.0.0.0
  

-p = Port

     

-b = Bind Address

    
17.12.2015 / 17:19