adding in basics of api

This commit is contained in:
talksik
2022-03-15 16:01:15 -04:00
parent ef72bc3158
commit e9a02eb091
10 changed files with 707 additions and 28 deletions
+24
View File
@@ -0,0 +1,24 @@
import express, { Application, Request, Response } from "express";
import { NextFunction } from "express";
import getRoutes from "./routes";
const cors = require("cors");
const app = express();
app.use(cors());
app.use((req: Request, res: Response, next: NextFunction) => {
console.log("Time: ", Date.now());
next();
});
app.get("/", (req: Request, res: Response) => {
res.send("hello world.");
});
app.use("/api", getRoutes());
app.listen(5000, () => console.log("Example app is listening on port 5000."));