Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular.js Tutorial using the Node.js webserver [closed]

I am trying to go through the Angular.js Tutrorial_00 and cannot seem to work out how to get the node.js web server to run the demo app?

Has anyone done this tutorial or know how correctly use this step to get the server working?

  1. For node.js users: In a separate terminal tab or window, run node scripts\web-server.js to start the web server. Open a browser window
  2. for the app and navigate to http://localhost:8000/app/index.html

What happens is that I run step 1 in node.js and then it outputs "...", which I assum means it is listening.

Then when I get to step 2 I type that in the browser and get "Oops! Google Chrome could not connect to ".

like image 420
ojhawkins Avatar asked Mar 27 '13 12:03

ojhawkins


People also ask

Do you need a Web server to run AngularJS?

You don't need a server-side engine to dynamically compose application pages because Angular does that on the client-side. If the application uses the Angular router, you must configure the server to return the application's host page ( index.html ) when asked for a file that it does not have.

Can I use AngularJS with NodeJS?

Both can be combined to create isomorphic web applications. NodeJS is the cross-platform and a run-time environment for Javascript applications. AngularJS is an open-source platform for web application development which is maintained by Google. In order to use NodeJS, you need to install it into your system.

Can I use AngularJS without NodeJS?

You do not need to use Node anywhere in production server to use front-end JavaScript frameworks like Angular or react etc. We can use any backend webserver technology written in any language (C# ,Java etc.)


1 Answers

node scripts\web-server.js is a command line, not a piece of JavaScript.

Run it in a shell (on Windows that probably means PowerShell) while making sure you are in the right directory. Don't try to run it in a node REPL.

like image 65
Quentin Avatar answered Oct 05 '22 18:10

Quentin