Nover
A Node.js powered HTTP server.
Why Nover?
As a Web developer, I often found that I really need a HTTP server which is more comprehensive than Python SimpleHttpServer but more light-weight than Apache and Nginx.
Supports
- Static Web sites
- RESTful APIs written in Node.js
- WebSocket
- URL Rewrite
- Virtual Hosts
- Customized middleware
Usage
nover <config_file>
Config Tips
- Run
nover -h
to show an example nover config. - If
port
is not given in the top section of config files, HTTP port will be assigned toprocess.env.PORT
. - Use
$ROOT
as the shorthand of the document root defined byroot
. - Use
$PWD
to represent the location of the config file. - Use
$DOMAIN
to indicate the main domain set bydomain
. - For WebSocket,
$PORT
can be used to indicate the same port defined byport
in the top section of config file. - When setting rewrites, please be awared that the request urls will also contain a leading
/
(slash). For example, to rewriteexample.com/nover
thepattern
should be something like^/nover/?$
rather than^nover/?$
. - System variables are not supported in the
data
attributes of APIs and Socekts.
Sample config
Sample RESTful API
To register Node.js powered APIs, please make sure the exposes of __get
, __post
, __delete
, __put
, and __all
#!/usr/bin/env nodeexports { 'use strict'; var name = reqparamsname; res;};
Sample Socket.io App
Please make sure your app exposes __socket
for Nover.
#!/usr/bin/env node exports { 'use strict'; var io = ; iosockets; };
Sample Middleware
Please make sure your module exposes __middle
exports { 'use strict'; console; ;};
Sample Require Module
Please make sure your required Nover module exposes __require
The parameter data is an object that contains:
- http: The main HTTP object of Nover server.
- port: The main port number.
- root: The
root
directory. - domain: The main domain.
exports { 'use strict'; var http = datahttp; http;};
License
Nover is licensed under MIT.