add definitions for express-jwt

This commit is contained in:
wokim
2014-11-21 11:21:14 +09:00
parent a17e409c11
commit 920d3f0292
2 changed files with 47 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="./express-jwt.d.ts" />
import express = require('express');
import jwt = require('express-jwt');
import unless = require('express-unless');
var app = express();
app.use(jwt({
secret: 'shhhhhhared-secret'
}));
app.use(jwt({
secret: 'shhhhhhared-secret',
userProperty: 'auth'
}));
var jwtCheck = jwt({
secret: 'shhhhhhared-secret'
});
jwtCheck.unless = unless;
app.use(jwtCheck.unless({ path: '/api/login' }));
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for express-jwt
// Project: https://www.npmjs.org/package/express-jwt
// Definitions by: Wonshik Kim <https://github.com/wokim/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
/// <reference path="../express-unless/express-unless.d.ts" />
declare module "express-jwt" {
import express = require('express');
import unless = require('express-unless');
function jwt(options: jwt.Options): jwt.RequestHandler;
module jwt {
export interface Options {
secret: string;
skip?: string[];
credentialsRequired?: boolean;
}
export interface RequestHandler extends express.RequestHandler {
unless?: typeof unless;
}
}
export = jwt;
}