1.0.1 • Published 1 year ago

simpressjs v1.0.1

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
github
Last release
1 year ago

simpress

This package is a simple analogue of Express.js.

Installation

npm i simpressjs

Usage

Trivial example:

import { createServer } from 'http';

import { Simpress } from 'simpressjs';

const host = 'localhost';
const port = 8000;

const app = new Simpress();

app.route('/', 'GET', (req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'application/json');
  res.end(JSON.stringify({ hello: 'world' }));
});

const server = createServer(app.toListener());

server.listen(port, host, () => {
  console.log(`Server is running on http://${host}:${port}`);
});

License

BSD 3-Clause License