1.0.7 • Published 1 year ago

huno-server v1.0.7

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Installation

$ npm install huno-server

Usage example

import { HunoServer, sendJson, parseJsonBody } from 'huno-server';

const app = new HunoServer();

app.get('/', function ({ req, res }) {
  sendJson(res, { message: 'Hello Huno' });
});

app.post('/', function ({ req, res }) {
  const body = await parseJsonBody(req);

  sendJson(req, body);
});

// using params
app.get('/:id', function ({ req, res, params }) {
  const id = params.id;
  sendJson(res, { id: id });
});

app.start(3000);
1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago