JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q37088F
  • License MIT

JWT-checking decorator for typescript-rest

Package Exports

  • typescript-rest-jwt-guard

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (typescript-rest-jwt-guard) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

JwtGuard for typescript-rest

Installation

Using npm:

$ npm i typescript-rest-jwt-guard

Or using yarn:

$ yarn add typescript-rest-jwt-guard

Usage

import { Path, GET, Context, ServiceContext } from 'typescript-rest';
import { Inject } from 'typescript-ioc';
import JwtGuard from 'typescript-rest-jwt-guard';

@Path('/health')
export default class HealthController {

  // Simple method.
  @GET
  public getHealthStatus() {
    return { message: 'Ok' };
  }

  // Method requiring JWT.
  @JwtGuard
  @Path('/secured')
  @GET
  public getHealthStatusSecured(@Context _context: ServiceContext) {
    return { message: 'Ok' };
  }
}