sard.js
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

Sard.js

no longer update. use osik instead

Very Tiny Http Server Module

Installation

$ npm i --save-dev sard.js

Example

const sard = require('sard.js');
const app = sard.server({ logging: true });

app.use((req, res, next) => {
  // middleware
  req.name = 'world';
  next();
});

app.get('/', (req, res) => {
  res.setHeader('Content-Type', 'text/html');
  res.end(`<p>Hello ${req.name}</p>`);
});

app.get('/users/:name', (req, res) => {
  res.end(`Hello, ${req.params.name}!`);
});

app.listen(3000, () => {
  // callback
});

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i sard.js

Weekly Downloads

2

Version

0.2.1

License

none

Unpacked Size

10.9 kB

Total Files

5

Last publish

Collaborators

  • do4ng