1.0.3 • Published 5 years ago

@hamjs/http v1.0.3

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

@hamjs/http

This is a mini HTTP server library for NodeJS.

Why @hamjs/http?

This library is very fast as it is zero dependency.

Installation

Run this command in your project directory!

$ npm install @hamjs/http

Usage

Before you use @hamjs/http, you have to require it. Example, below.

const http = require('@hamjs/http');

Then, you can create and listen the server. Example, below.

...
const app = new Http();
// routing here
...
app.listen(PORT, callback);

To add route, you can use the router. Example, below.

...
app.router.get(PATH, handler);
...

The handler look like here.

...
(ctx) => {
  ctx.send('Anything.');
}
...

Full example code.

const Http = require('@hamjs/http');

const app = new Http();

app.router.get('/', (ctx) => {
  ctx.send('halo ');
});

app.listen(8080, () => {
  console.log('app start');
});
1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago