1.4.6 • Published 10 years ago

statik v1.4.6

Weekly downloads
43
License
-
Repository
github
Last release
10 years ago

Static

A simple and easy-to-use Node.js module to server static files over HTTP. It's super simple to use it.

npm

Submission to NPM repository pending

// package.json
// ...
dependencies: {
	"static": ">= 0.0.1"
}

Usage

// app.js
var static = require('static');
var server = static.createServer();
server.listen(3000);

Your server will be running on http://localhost:3000 serving ./public directory.

Customisations

You can specify the directory you wish to serve as an argument.

// app.js
var static = require('static');
var server = static.createServer('/Users/hongymagic/Sites');
server.listen();

Your server will be running on http://localhost:1203 server /Users/hongy/magic/sites directory.

What about the HTTP Headers?

There are some default HTTP Headers that I am going to introduce for the reaons why I have create this package in the first place:

  1. Content-Type: static uses another internal Node.js package mime to check against content types
  2. Cache-Control: 'no-cache'. The primary purpose of static was so I could easily run a folder as web server over HTTP while I'm working on a new site. Might as well kill off the cache while I'm writing and debugging CSS and JavaScript. There will be an option to disable to default behaviour though.

FAQ

Why default to port 1203?

It's all personal.

1.4.6

10 years ago

1.4.5

10 years ago

1.4.4

10 years ago

1.4.3

11 years ago

1.4.2

11 years ago

1.4.1

11 years ago

1.4.0

11 years ago

1.2.5

12 years ago

1.2.4

12 years ago

1.2.3

12 years ago

1.2.1

12 years ago

1.2.0

12 years ago

1.1.4

12 years ago

1.1.3

12 years ago

1.1.2

12 years ago

1.1.1

12 years ago

1.1.0

12 years ago

1.0.1

12 years ago

1.0.0

12 years ago