Socket
Socket
Sign inDemoInstall

grin-server

Package Overview
Dependencies
76
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    grin-server

Express-wrapper with TypeScript decorators


Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

grin-server

grin-server is a small, lightweight express-wrapper that uses TypeScript decorators and metadata.

Installation

With NPM: npm install --save grin-server

With YarnPKG: yarn add grin-server

Usage

index.ts

# index.ts
import { build } from 'grin-server';
import express from 'express';
import { App } from './App';

const bootstrap = async () => {
    let app: express.Application = build(App);
    
    app.listen(3000);
};

bootstrap();

App.ts

# App.ts
import { Server } from 'grin-server';
import helmet from 'helmet';
import Cats from './controllers/Cats';

@Server({
    controllers: [Cats],
    middlewares: [helmet()], # Express Middlewares
})
export class App {}

controllers/Cats.ts

import { Controller, Get } from 'grin-server';
import express from 'express';

let cats = [
  "Albert",
  "Moustache"
];

@Controller('/cats')
export class Cats {
    @Get('/')
    fetchCats(_: express.Request, res: express.Response) {
        res.json(cats);
    }
}

Keywords

FAQs

Last updated on 28 May 2021

Did you know?

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc