Socket
Book a DemoInstallSign in
Socket

cloverjs

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cloverjs

Typescript Decorators based api framework built on top of express.js

0.0.21
latest
npmnpm
Version published
Weekly downloads
8
-11.11%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

api

FAQs

Package last updated on 01 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.