0.1.4 • Published 7 years ago
lightwish v0.1.4
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');