2023-02-04 12:56:15 +01:00
|
|
|
const express = require("express");
|
|
|
|
const app = express();
|
|
|
|
const port = 3000;
|
|
|
|
const { client } = require("../clients/twitch.js");
|
2023-02-04 17:06:41 +01:00
|
|
|
const path = __dirname + "/front/dist/";
|
|
|
|
|
|
|
|
app.use(express.static(path));
|
2023-02-04 12:56:15 +01:00
|
|
|
|
|
|
|
app.get("/api/v1/commands", (req, res) => {
|
|
|
|
res.json(client.commands);
|
|
|
|
});
|
|
|
|
|
2023-02-04 17:06:41 +01:00
|
|
|
app.get("/api/v1/commands/:name", (req, res) => {
|
|
|
|
res.json(client.commands[req.params.name]);
|
|
|
|
});
|
|
|
|
|
2023-02-05 12:27:24 +01:00
|
|
|
app.get("*", (req, res) => {
|
2023-02-04 17:06:41 +01:00
|
|
|
res.sendFile(path + "index.html");
|
|
|
|
});
|
|
|
|
|
2023-02-04 12:56:15 +01:00
|
|
|
app.listen(port, () => {
|
2023-02-08 15:42:25 +01:00
|
|
|
console.log(`Front end listening on port ${port}`);
|
2023-02-04 12:56:15 +01:00
|
|
|
});
|