Create a static server with node-static

We’ll use node-static to create the instance, first load it from npm:

$ sudo npm install node-static

Create a server.js file in your root path:

To activate your static server, run:

$ node server.js

Now you’ll have access to all your static files inside /public folder, for example home.html -> http://localhost:1331/home.html.

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