Description
This project will allow you to quickly set up backend services in TypeScript. The main point is to use decorators to automatically declare routers and paths.
How to use
- Install BOOKit as dependency
- By npm:
npm i @smsnm/bookit
- By yarn:
yarn add @smsn/bookit
- By pnpm:
pnpm add @smsn/bookit
- By npm:
- Write a class to be used as a router:
import { Router } from '@smsnm/bookit'; @Router() export default class MainRouter {}
- Add method with decorator (for example GET):
import { Router, Get } from '@smsnm/bookit'; @Router() export default class MainRouter { @Get() hello() { return '<h1>Hello, BOOKit!</h1>'; } }
- In main script initialize common class and add the router:
import { Bookit } from '@smsnm/bookit'; import MainRouter from 'path/to/router'; const kit = new Bookit(); kit.addRouters(MainRouter); kit.start(7910, 'Server started!');
- Run!
Documentation
Documentation can be found at: https://samsonium.github.io/bookit/
This is a temporary documentation, which, in the future, will be replaced by the normal
Contributing
Contribution guide is under development...