3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-19 08:05:01 +00:00

Auto-generate plugin docs (WIP)

This commit is contained in:
Dragory 2019-08-22 01:22:26 +03:00
parent 7468e5348d
commit 9e69b3bf5b
44 changed files with 599 additions and 150 deletions

View file

@ -4,6 +4,7 @@ import cors from "cors";
import { initAuth } from "./auth";
import { initGuildsAPI } from "./guilds";
import { initArchives } from "./archives";
import { initDocs } from "./docs";
import { connect } from "../data/db";
import path from "path";
import { TokenError } from "passport-oauth2";
@ -12,15 +13,13 @@ import { PluginError } from "knub";
require("dotenv").config({ path: path.resolve(__dirname, "..", "..", "api.env") });
function errorHandler(err) {
// tslint:disable:no-console
console.error(err.stack || err);
console.error(err.stack || err); // tslint:disable-line:no-console
process.exit(1);
// tslint:enable:no-console
}
process.on("unhandledRejection", errorHandler);
console.log("Connecting to database...");
console.log("Connecting to database..."); // tslint:disable-line
connect().then(() => {
const app = express();
@ -34,6 +33,7 @@ connect().then(() => {
initAuth(app);
initGuildsAPI(app);
initArchives(app);
initDocs(app);
// Default route
app.get("/", (req, res) => {
@ -45,7 +45,7 @@ connect().then(() => {
if (err instanceof TokenError) {
clientError(res, "Invalid code");
} else {
console.error(err);
console.error(err); // tslint:disable-line
error(res, "Server error", err.status || 500);
}
});
@ -56,5 +56,6 @@ connect().then(() => {
});
const port = process.env.PORT || 3000;
// tslint:disable-next-line
app.listen(port, () => console.log(`API server listening on port ${port}`));
});