npm.io
2.0.7 • Published 8 years ago

hinos

Licence
ISC
Version
2.0.7
Deps
2
Size
16 kB
Vulns
1
Weekly
0

hinos

Pure nodejs framework, EXTREME FAST and LIGHT WEIGHT. It is optimized for large projects. And of course, it get best performance "hinos" is not bundled with any middleware. It's only nodejs native

Installation

npm i hinos -S

Examples

Typescript

import { Server, Context } from 'hinos';

const yourMiddleware = async (ctx: Context, next: Function) => {
    // Return error
    if(ctx.query.isError) ctx.throws(401, 'error');
    // Return data
    ctx.data = {
        msg: 'Hello world!'
    }
    await next();
}

Server.use(yourMiddleware);

Server.listen(1337, () => {
    console.log('Server is listening at port %d', 1337);
});

Nodejs

const hinosserver = require("hinos");
const Server = hinosserver.Server;

const yourMiddleware = async (ctx, next) => {
    // Return error
    if(ctx.query.isError) ctx.throws(401, 'error');
    // Return data
    ctx.data = {
        msg: 'Hello world!'
    }
    await next();
}

Server.use(yourMiddleware);

Server.listen(1337, () => {
    console.log('Started');
});