Skip to content

Kernel/Core module for Macchiato.js -- Current Version: 0.24.0 -- | [still under dev but you can use it] | >> Soony, I will add the documentation <<.

License

Notifications You must be signed in to change notification settings

macchiatojs/kernel

Repository files navigation

@macchiatojs/kernel

Installation

# npm
$ npm install @macchiatojs/kernel
# yarn
$ yarn add @macchiatojs/kernel

Usage

I'm working to add full documentations as soon as possible <3.

// Express/Connect Style
import Macchiato, { Request, Response, Next } from "@macchiatojs/kernel";

const app = new Macchiato();

app.use((request: Request, response: Response, next?: Next) => {
  response.body = "Hello World !"; // also you can use .send(200, "Hello World !")
});

app.start(2222);

// Koa Style
import Macchiato, { Context, Next } from "@macchiatojs/kernel";

const app = new Macchiato({ expressify: false });

app.use((context: Context, next?: Next) => {
  context.response.body = "Hello World !"; // also you can use .send(200, "Hello World !")
});

app.start(2222);

If you want to use the famous koa-compose for mws;

import Macchiato, { Context, Next } from "@macchiatojs/kernel";
// don't forget to add '@macchiatojs/wrap-koa-compose' and 'koa-compose'
import WrapKoaCompose from "@macchiatojs/wrap-koa-compose";

const app = new Macchiato({
  koaCompose: new WrapKoaCompose<Context, Next>(),
});

Support

If you have any problem or suggestion please open an issue.

License


MIT © Imed Jaberi

About

Kernel/Core module for Macchiato.js -- Current Version: 0.24.0 -- | [still under dev but you can use it] | >> Soony, I will add the documentation <<.

Resources

License

Stars

Watchers

Forks

Packages

No packages published