kirbe

0.0.4 • Public • Published

Kirbe


Install Size Discord NPM version NPM version Patreon

npm installnfo

A lightweight and fast Node.js HTTP server library

GitHub | NPM

Installing

$ yarn add kirbe # Install w/ Yarn (the superior package manager) 
$ npm i kirbe # Install w/ NPM 

Usage

Start a HTTP(s) server on port 8080 and add some routes

const kirbe = require( 'kirbe' ); // Define kirbe
const app = new kirbe(); // Make your kirbe instance
 
app.route( '/bear', 'GET', ( req, res ) => res.status( 200 ).body({ 'bear': 'cop' }) );
app.route( ( req, res ) => res.status( 404 ).body( 'Error: Content not found!' ).end() );
app.get( '/kirb', ( req, res ) => {
  res.writeHead( 201, { 'test': 'hi' });
  res.end({ 'key': 'hi' });
});
 
// HTTP
app.listen( 8080, () => console.log( 'Listening on port 8080!' ) );
// HTTPS
const https = require( 'https' ); // This should be at the top of your code
https.createServer( app.externalHandler ).listen( 8080 );

Default extensions ( /model/middleware )

Static

Host static files on your website

Usage
const path  = require( 'path' ); // Define path
const kirbe = require( 'kirbe' ); // Define kirbe
const app = new kirbe(); // Make your kirbe instance
 
app.use( kirbe.static( path.join( __dirname, 'static' ) ) );

Creating your own

If you want to add your own extension/middleware, you can either create your own module or add it to the /model/middleware and then create a pull request!

Why use kirbe?

Kirbe is a lightweight and fast HTTP server library, especially comparing to express and connect which are around 1mb in size with multiple dependencies. If you want any features that aren't inside of Kirbe yet, you can open an issue or pull request.

You can join https://discord.gg/SV7DAE9 if you need any support using kirbe!

Package Sidebar

Install

npm i kirbe

Weekly Downloads

0

Version

0.0.4

License

MIT

Unpacked Size

20.7 kB

Total Files

15

Last publish

Collaborators

  • wesselgame