Skip to content
This repository has been archived by the owner on Mar 7, 2023. It is now read-only.

Latest commit

 

History

History
37 lines (28 loc) · 773 Bytes

README.md

File metadata and controls

37 lines (28 loc) · 773 Bytes

KingWorld Controllers

  • This plugin adds decorator and controller-based routing support to kingworld.

IMPORTANT! Bun doesn't support decorators yet, so you'll need to upgrade bun by using bun upgrade --canary

Installation

bun add kingworld-controllers

Usage

import { Controller, Get, kwControllers } from 'kingworld-controllers'; 

// /users prefix
@Controller('/users/')
class UsersController {
  @Get()
  index() {
    return 'Hello World';
  }
}

const app = new KingWorld();

app.use(kwControllers, {
  controllers: [UsersController],
});

app.listen(3000);

License

  • This project is licensed under the MIT License - see the LICENSE file for details