Skip to content

Commit

Permalink
added backend
Browse files Browse the repository at this point in the history
  • Loading branch information
DeveshSuryawanshi committed Feb 7, 2024
1 parent 6c68677 commit 159a72c
Show file tree
Hide file tree
Showing 6 changed files with 2,029 additions and 0 deletions.
31 changes: 31 additions & 0 deletions backend/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
const express = require("express");
const cors = require("cors");
require("dotenv").config();
const {connection} = require("./src/config/db");
const {userRouter} = require("./src/routes/user.routes")

const app = express();
app.use(cors());
app.use(express.json());
app.use("/users", userRouter);

app.get("/", async (req, res) => {
try {
res.setHeader("text-content", "text/html");
res.status(200).send("<h1>Welcome to the Authentication-app</h1>");
} catch (error) {
res.status(400).json({ error });
}
});

app.listen(process.env.PORT, async () => {
try {
await connection;
console.log("Connected to the database successfully");
console.log(`Server is Runing on PORT ${process.env.PORT}`);
} catch (error) {
console.log(error);
}
});


Loading

0 comments on commit 159a72c

Please sign in to comment.