feat: initial setup backend with default routes and db connection
This commit is contained in:
26
server/src/index.ts
Normal file
26
server/src/index.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import dotenv from "dotenv";
|
||||
import express from "express";
|
||||
import "reflect-metadata";
|
||||
const cors = require("cors");
|
||||
|
||||
import locationRoutes from "./controller/locationController";
|
||||
import lpTtnEndDeviceUplinksRoutes from "./controller/lpTtnEndDeviceUplinksController";
|
||||
import ttnGatewayReceptionRoutes from "./controller/ttnGatewayReceptionController";
|
||||
import wifiScanRoutes from "./controller/wifiScanController";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const app = express();
|
||||
const PORT = process.env.PORT || 3000;
|
||||
|
||||
app.use(cors());
|
||||
app.use(express.json());
|
||||
|
||||
app.use("/api/lp-ttn-end-device-uplinks", lpTtnEndDeviceUplinksRoutes);
|
||||
app.use("/api/wifi-scans", wifiScanRoutes);
|
||||
app.use("/api/ttn-gateway-receptions", ttnGatewayReceptionRoutes);
|
||||
app.use("/api/locations", locationRoutes);
|
||||
|
||||
app.listen(PORT, () => {
|
||||
console.log(`🚀 Server läuft auf http://localhost:${PORT}`);
|
||||
});
|
Reference in New Issue
Block a user