mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-22 11:57:33 +08:00
19 lines
353 B
TypeScript
19 lines
353 B
TypeScript
|
|
|
|
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());
|