@smsnm/bookit
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

BOOKit Logotype

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

  1. Install BOOKit as dependency
    • By npm: npm i @smsnm/bookit
    • By yarn: yarn add @smsn/bookit
    • By pnpm: pnpm add @smsn/bookit
  2. Write a class to be used as a router:
    import { Router } from '@smsnm/bookit';
    
    @Router()
    export default class MainRouter {}
  3. 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>';
       }
    }
  4. 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!');
  5. 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...

Package Sidebar

Install

npm i @smsnm/bookit

Weekly Downloads

4

Version

1.2.1

License

MIT

Unpacked Size

24.8 kB

Total Files

38

Last publish

Collaborators

  • smsnm