Attributes
Includes Deno configuration
Repository
Current version released
a year ago
Dependencies
deno.land/x
oauth
π OAUTH middlewares for nhttp written in TypeScript
Example β¨
import { NHttp } from "https://deno.land/x/nhttp@1.2.11/mod.ts";
import { Controller, Get, Post, Wares } from "https://deno.land/x/nhttp@1.2.11/lib/controller.ts";
import {
Auth,
DiscordMiddleware
type RequestEvent
} from "./src/mod.ts";
Auth.init({
discord: {
client_id: "",
client_secret: "",
redirect_uri: "http://localhost:3000/oauth/discord"
}
});
@Controller("/oauth")
class OAUTHController {
@Wares(DiscordMiddleware)
@Get("/discord")
get_index({ response: res, request: req }: RequestEvent) {
return res.status(200).json({
data: req.discord
});
}
}
class Application extends NHttp {
constructor() {
super();
this.use("/", [
new OAUTHController()
]);
}
}
new Application().listen(3000);
Contributing β¨