Files
threetwo/src/server/index.ts
Rishi Ghan 2d61fa1436 Changing the build system to Vite (#62)
* 🔧 Updated date for PullList on Dashboard

* ️ Added Vite config and removed useless files

* 👷🏽 Updated build command

*  Removed useless deps

* 🔧 Cleaned up package.json and bumped airdcpp-apisocket

* 🔧 Updated some packages and deps

* ⬆️ Bumped some deps

* 🔧 Fixed typo in package.json

* 🔧 Fix for broken paths https://github.com/rishighan/threetwo/issues/63

* 🔧 Fixed broken path and npm script

Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com>

---------

Signed-off-by: Rishi Ghan <rishi.ghan@gmail.com>
2023-03-01 23:31:22 -05:00

42 lines
1.2 KiB
TypeScript

import express, { Router, Express } from "express";
import bodyParser from "body-parser";
import router from "./route";
// call express
const app: Express = express(); // define our app using express
const port: number = Number(process.env.PORT) || 8050; // set our port
// Configure app to respond with these headers for CORS purposes
app.use(function (req, res, next) {
res.header("Access-Control-Allow-Origin", "*");
res.header(
"Access-Control-Allow-Headers",
"Origin, X-Requested-With, Content-Type, Accept",
);
next();
});
// configure app to use bodyParser for
// Getting data from body of requests
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));
//
// app.get("/", (req: Request, res: Response) => {
// console.log("sending index.html");
// res.sendFile(path.resolve(__dirname, "../dist/index.html"));
// });
// REGISTER ROUTES
// all of the routes will be prefixed with /api
const routes: Router[] = Object.values(router);
// app.use("/api", routes);
// Send index.html on root request
// app.use(express.static("dist"));
// app.use(express.static("public"));
// app.listen(port);
// console.log(`Server is listening on ${port}`);