mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
20 lines
445 B
TypeScript
20 lines
445 B
TypeScript
/// <reference path="../express/express.d.ts" />
|
|
/// <reference path="oauth2-server.d.ts" />
|
|
|
|
import * as express from "express";
|
|
import * as oauthserver from "oauth2-server";
|
|
|
|
var oauth = oauthserver({
|
|
model: {},
|
|
grants: ['password'],
|
|
debug: true
|
|
});
|
|
|
|
var app = express();
|
|
|
|
app.all('/oauth/token', oauth.grant());
|
|
app.get('/', oauth.authorise(), function (req, res) {
|
|
res.send('Secret area');
|
|
});
|
|
app.use(oauth.errorHandler());
|