Skip to content

Commit

Permalink
fix: use dotenv package to load env variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Lyton505 committed Nov 3, 2024
1 parent e9d1bf0 commit 156e504
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions api/src/server.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
import express from "express";
import bodyParser from "body-parser"
import bodyParser from "body-parser";
import connectDB from "./config/db";
import dotenv from "dotenv";

import * as routes from "./routes/index"
dotenv.config();

var cors = require("cors")
import * as routes from "./routes/index";

const app = express()
app.use(cors())
app.use(bodyParser.json())
app.use(bodyParser.urlencoded({ extended: true }))
var cors = require("cors");

app.use("/user", routes.user)
const app = express();
app.use(cors());
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: true }));

app.listen(process.env.PORT || 8000, () => console.log("Server running..."))
app.use("/user", routes.user);

app.listen(process.env.PORT || 8000, () => console.log("Server running..."));

0 comments on commit 156e504

Please sign in to comment.