New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

thints

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

thints

A simple, angular based and typed framework for RestAPIs with node.

latest
Source
npmnpm
Version
4.1.0
Version published
Maintainers
1
Created
Source

ThinTS

Build Status NPM Version npm

A simple, angular based and typed framework for RestAPIs with node.

Depedencies

* Typescript
* Node.js (tested in >=7.6)
* Express

Installation

$ npm install thints --save

QuickStart

Quick example.

import {MainApplication, MainApplicationConfig, ThModule, ThController, ThRouter, GET} from "thints";

@ThController()
class ExampleController {
    private name = 'ThinTS';
    getMyName() {
        return this.name;
    }
}

@ThRouter('/name')
class ExampleRouter {
    constructor(private exampleCtrl: ExampleController) {}
    
    @GET('/') myname(req: Request, res: Response) {
    	const myname = this.exampleCtrl.getMyName();
    	res.json({myname});
    }
}

@ThModule({
    basePath: '/api',
    controllers: [ ExampleController ],
    routers: [ ExampleRouter ]
})
class MyApiModule {}


const config: MainApplicationConfig = {
    http: {
        autostart: true, // default true
        port: 8000, // default 80
        host: "localhost" // default "localhost"
    },
    https: {
        autostart: true, // default false
        port: 8443, // default 443
        host: "localhost", // default "localhost"
        credentials: {
            keyUrl: "my/key/url.key",
            certificateUrl: "my/cert/url.cert"
        }
    }
};


bootstrap(MyApiModule, config);

A GET request to 'url/api/name' call ExampleRouter and return:

{ "myname": "ThinTs" }

Usage

TypeDocs

Core

MainApplication

ThinTS start point, responsible to bootstrap your module and create initial depedenct tree with essentials imports.

MainApplication.bootstrap(MyModule);
MORE



ThModule

Module is responsible to create scopes and declare components.

MORE



ThController

MORE



ThRouter

MORE



ThModel

MORE



ThMiddleware

MORE



ExpressController

MORE





Routing

Introduction

MORE



GET

MORE



POST

MORE



PUT

MORE



DELETE

MORE



PARAM

MORE

License

MIT

Keywords

typescript

FAQs

Package last updated on 14 Dec 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