0.1.3 • Published 1 year ago

yet-another-http v0.1.3

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

Yet Another HTTP - My own NodeJS REST API implementation

I don't like express.js. This is too weak HTTP framework for building serious projects. It is even not available to read POST data out of box.

I decided to write my own HTTP server implementation that allows get most features (reading POST data, context and so on) without installing any HTTP framework.

Docs Site

https://yah.congritta.com

Requirements

  • Node.JS v18;
  • Yarn

At the moment, my implementation`s features:

  • Built on native node http server;
  • Written in Typescript;
  • Various HTTP servers with instances of Server class;
  • Middleware support;
  • Context data over middlewares and handlers support;
  • Can read POST data out of box. JSON, multipart/form-data, urlencoded supported;
  • Plugin API;
  • Built-in error handling;
  • Automatic minimizes (on production) and prettify (on development) JSON HTTP responses

How to install

yarn add yet-another-http

Server example

import Server, {Response} from "yet-another-http";

const server = new Server(8000);

server.on("GET", "/", () => {
  return new Response(200, "Hello World");
});

server.run().then(() => {
  console.log(`HTTP Server started at http://${server.host}:${server.port}`);
});
0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago

0.0.1

1 year ago