0.1.4 • Published 7 years ago

lightwish v0.1.4

Weekly downloads
4
License
MIT
Repository
github
Last release
7 years ago

lightwish

Lightweight web server. Inspired by Nginx and Express.

Usage

var lw = require('lightwish');
var server = lw.server({
    port: 80,
    root: '.'
});

server.route('get', '/hello', (resp) => {
    resp.header('Content-Type', 'text/plain');
    resp.body('hello');
});

server.listen();

Reference

Response

HTML

resp.html('<a href="#">link</a>');
// or
resp.header('Content-Type', 'text/html; charset=utf-8');
resp.body('<a href="#">link</a>');

Text

resp.text('hello');
// or
resp.header('Content-Type', 'text/plain; charset=utf-8');
resp.body('hello');