adding in basics of api
This commit is contained in:
@@ -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."));
|
||||
Reference in New Issue
Block a user