mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-05-18 07:35:02 +00:00
Dashboard work. Move configs to DB. Some script reorganization. Add nodemon configs.
This commit is contained in:
parent
38c65b9618
commit
323c7e66aa
39 changed files with 8441 additions and 2915 deletions
29
src/api/index.ts
Normal file
29
src/api/index.ts
Normal file
|
@ -0,0 +1,29 @@
|
|||
require("dotenv").config();
|
||||
|
||||
import express from "express";
|
||||
import cors from "cors";
|
||||
import { initAuth } from "./auth";
|
||||
import { initGuildsAPI } from "./guilds";
|
||||
import { connect } from "../data/db";
|
||||
|
||||
console.log("Connecting to database...");
|
||||
connect().then(() => {
|
||||
const app = express();
|
||||
|
||||
app.use(
|
||||
cors({
|
||||
origin: process.env.DASHBOARD_URL,
|
||||
}),
|
||||
);
|
||||
app.use(express.json());
|
||||
|
||||
initAuth(app);
|
||||
initGuildsAPI(app);
|
||||
|
||||
app.get("/", (req, res) => {
|
||||
res.end({ status: "cookies" });
|
||||
});
|
||||
|
||||
const port = process.env.PORT || 3000;
|
||||
app.listen(port, () => console.log(`API server listening on port ${port}`));
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue