@plumier/jwt
Advanced tools
Comparing version 1.0.0-canary.0 to 1.0.0-canary.3
import { AuthorizeStore, DefaultFacility, PlumierApplication, RouteInfo } from "@plumier/core"; | ||
import jwt from 'koa-jwt'; | ||
export declare type RoleField = string | ((value: any) => Promise<string[]>); | ||
@@ -11,5 +12,5 @@ export interface JwtAuthFacilityOption { | ||
private option; | ||
constructor(option: JwtAuthFacilityOption); | ||
constructor(option: JwtAuthFacilityOption & jwt.Options); | ||
setup(app: Readonly<PlumierApplication>): void; | ||
initialize(app: Readonly<PlumierApplication>, routes: RouteInfo[]): Promise<void>; | ||
} |
@@ -16,3 +16,3 @@ "use strict"; | ||
app.set({ authorizer: this.option.authorizer }); | ||
app.koa.use(koa_jwt_1.default({ secret: this.option.secret, passthrough: true })); | ||
app.koa.use(koa_jwt_1.default(Object.assign(Object.assign({ cookie: "Authorization" }, this.option), { secret: this.option.secret, passthrough: true }))); | ||
app.use(new core_1.AuthorizeMiddleware(this.option.roleField || "role", this.option.global)); | ||
@@ -19,0 +19,0 @@ } |
{ | ||
"name": "@plumier/jwt", | ||
"version": "1.0.0-canary.0+7c82523", | ||
"version": "1.0.0-canary.3+4337618", | ||
"description": "Plumier authorization module using JWT", | ||
@@ -13,5 +13,4 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"@plumier/core": "1.0.0-canary.0+7c82523", | ||
"koa-jwt": "^3.5.1", | ||
"tslib": "^1.9.3" | ||
"@plumier/core": "1.0.0-canary.3+4337618", | ||
"koa-jwt": "^3.6.0" | ||
}, | ||
@@ -28,3 +27,3 @@ "bugs": { | ||
}, | ||
"gitHead": "7c82523128405e9cf113f83523711c4b715b9583" | ||
"gitHead": "43376182a3be0704f41c0fa50ace7966de17bc22" | ||
} |
# Plumier | ||
Delightful Node.js Rest API Framework powered by Koa and TypeScript | ||
Delightful Node.js Rest Framework | ||
@@ -8,4 +8,24 @@ [![Build Status](https://travis-ci.org/plumier/plumier.svg?branch=master)](https://travis-ci.org/plumier/plumier) | ||
[![Greenkeeper badge](https://badges.greenkeeper.io/plumier/plumier.svg)](https://greenkeeper.io/) | ||
[![lerna](https://img.shields.io/badge/maintained%20with-lerna-cc00ff.svg)](https://lernajs.io/) | ||
## Blog Posts and Publications | ||
* [Reason, motivation and how Plumier designed](https://medium.com/hackernoon/i-spent-a-year-to-reinvent-a-node-js-framework-b3b0b1602ad5) | ||
* [How to use Plumier with mongoose](https://hackernoon.com/create-secure-restful-api-with-plumier-and-mongoose-3ngz32lu) | ||
* [Advanced usage of Plumier middleware to perform AOP and metaprogramming](https://hackernoon.com/adding-an-auditing-system-into-a-rest-api-4fbb522240ea) | ||
## Tutorials | ||
* [Basic REST api tutorial using Knex.js](https://plumierjs.com/docs/tutorials/basic-sql/get-started) | ||
## Examples | ||
* [Basic REST API with Knex.js](https://github.com/plumier/tutorial-todo-sql-backend) | ||
* [Basic REST api with Mongoose](https://github.com/plumier/tutorial-todo-mongodb-backend) | ||
* [Plumier - React - Monorepo - Social Login](https://github.com/plumier/tutorial-monorepo-social-login) | ||
* [Plumier - React Native - Monorepo](https://github.com/plumier/tutorial-todo-monorepo-react-native) | ||
## Motivation | ||
Plumier primarily created for full stack developer who spend more time working on the UI side and focus on creating a good user experience. Plumier comes with some built-in production-ready features that make creating secure JSON Api fun and easy. | ||
@@ -16,6 +36,26 @@ | ||
![Benchmarks](https://plumierjs.com/docs/assets/benchmarks.png) | ||
``` | ||
GET method benchmark starting... | ||
The benchmark project forked from Fastify benchmark project, you can test it your self [here](https://github.com/ktutnik/benchmarks). | ||
Server Base Method Req/s Cost (%) | ||
plumier koa GET 33624.00 -0.06 | ||
koa GET 33602.19 0.00 | ||
express GET 17688.37 0.00 | ||
nest express GET 16932.91 4.27 | ||
loopback express GET 5174.61 70.75 | ||
POST method benchmark starting... | ||
Server Base Method Req/s Cost (%) | ||
koa POST 12218.37 0.00 | ||
plumier koa POST 11196.55 8.36 | ||
express POST 9543.46 0.00 | ||
nest express POST 6814.64 28.59 | ||
loopback express POST 3108.91 67.42 | ||
``` | ||
Version 1.0.0-beta.9 successfully reduce the framework cost, its mean using Plumier is the same as using Koa + Koa Router + Joi stack with all of Plumier features. | ||
The benchmark script can be found [here](https://github.com/ktutnik/full-stack-benchmarks). | ||
### Flexible | ||
@@ -179,4 +219,3 @@ Almost every part of framework is fully configurable and easy to override. For example plumier route generation system provided flexibility using convention and also configuration. | ||
* Put breakpoint on any location you need on `.ts` file | ||
* Locate the `.js` version of the test file that will be run **(important)** | ||
* On start/debug configuration select `Jest Current File` and start debugging | ||
* Process will halt properly on the `.ts` file. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
14147
2
38
219
- Removedtslib@^1.9.3
- Removedtslib@1.14.1(transitive)
Updatedkoa-jwt@^3.6.0