Creating a simple server locally

If you are using ajax calls in javascript, it won’t work locally as browsers restrict xmlhttp calls.

Work around for this is to install node js locally and create a simple http server in any particular folder.

Once node is being installed, open node command prompt.

Locate to the folder and

Type
`npm install -g http-server`

This will create the server in your local folder

Then to start the server type
`http-server`

You can terminate it any time by ctrl+c

Advertisements

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s