Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

grin-server

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

grin-server

Express-wrapper with TypeScript decorators

  • 1.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
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

Package last updated on 28 May 2021

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

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc