Skip to content
Rest API framework built on expressjs focused on productivity by using typescript decorators and metadata
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
src
.gitignore
README.md
package.json
tsconfig.json

README.md

cloverjs

Rest API framework built on expressjs focused on productivity by using typescript decorators and metadata

Install

$ npm install --save cloverjs

Usage

import {ROUTE,GET,p,u} from 'cloverjs';

@ROUTE('/books')
class Books {
    
    @GET('/',false) // false for not requiring authentication
    async getBooks(){
        books = await ..........
        return books;
    }
    
    @GET('/:id')
    async getBook(@p('id') id:string){
        book = await ...........
        return book;
    }
    
    @POST('/')
    async createBook(@p params:any){
        // params is all the the path params,query & body merged   
    }
    
    @POST('/:id/like')
    async likeBook(@p('id'),@u user:any){
        // @u is to inject request.user   
    }
       
}

// bootstrap create expressjs app 
bootstrap({
    port:5000,
    parseUser:(req)=>{
        var user = {};// ... parse user from req
        req.user = user;
        return;
    }
},new Books());

License

MIT © Oussama Gammoudi

You can’t perform that action at this time.