Hello I am following this tutorial from the AngularJS documentation.
I am trying to use this approach for learning this.
You will need an http server running on your system. Mac and Linux machines typically have Apache pre-installed, but If you don't already have one installed, you can use node to run scripts/web-server.js, a simple bundled http server.
My server is started but the only things that happens on localhost:8000 (the port its running on) is that files get listed.
How do I deploy with Node.js?
When I navigate to localhost:8000 in my browser, this is my server log.
112-108-15:scripts phe$ ./web-server.js
Http Server running at http://localhost:8000/
GET / Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
GET / Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.65 Safari/537.36
As you can see the instruction , you need to run
node ./scripts/web-server.js
and go to http://localhost:8000/app/index.html
.
If you have node installed, go to the directory where your angular application is and type:
scripts/webserver.js
hit enter and voila!
You can visit your site at:
http://localhost:8000/
If you don't have node installed, install node and then go to the first step.
You need to serve the files from a server on your local machine.
In the docs, it is mentioned you can serve the files from a node server.
However, if you do not want to download and run nodejs, and you are on Mac/Linux you have python already installed, you can also cd
into the directory with index.html
and run a python server - python -m SimpleHTTPServer 8000
. This will serve the files on port 8000. Go to localhost:8000 and you will see your files being rendered.
And, if you want to deploy it to production on a remote machine, I came across deployment of nodejs & angular application deployment to production using ansible. I used the same to deploy my first app to production.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.