Home > AngularJs > Setup a Javascript server for running angular app using st package

Setup a Javascript server for running angular app using st package

If you need a Javascript web server to run angular apps. Please follow the below steps.

1. Install node.

2. Go to the working directory and install st package (https://www.npmjs.com/package/st)

12

3. Create a server.js file in the working directory with the following code

var st = require('st')
var http = require('http')
http.createServer(st({path:process.cwd(),cache:false})).listen(1337)
console.log('Running server at localhost:1337/')

 

4. Run the server.js using node

13

5. Create an index.html file in the working directory and check the server path

15

14

Happy coding 🙂

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: