-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First Commit: Implement All Endpoints for the Task
Description: This commit completes the implementation of all the necessary endpoints for email scheduling and updation, deletion, findOne, findAll
- Loading branch information
0 parents
commit 4e29d0a
Showing
17 changed files
with
2,393 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/node_modules | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
PORT=3000 | ||
MONGO_URI=mongodb://127.0.0.1/sample | ||
CLIENT_URL=http://localhost:5000 | ||
|
||
GMAIL_USERNAME= | ||
GMAIL_SECURITY_PIN= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import express from "express" | ||
import dotenv from "dotenv"; | ||
import helmet from 'helmet'; | ||
dotenv.config(); | ||
import morgan from "morgan"; | ||
import errorHandler from "./src/middlewares/error/errorHandler.js"; | ||
import cors from "./src/middlewares/security/cors.js"; | ||
import connectDatbase from "./src/config/database.js" | ||
import router from "./src/routes/emailRoutes.js" | ||
|
||
const app = express(); | ||
app.use(cors); | ||
app.use(helmet()); | ||
app.use(express.json()); | ||
app.use(express.urlencoded({ extended: true })); | ||
|
||
if (process.env.NODE_ENV === "development") app.use(morgan("dev")); | ||
|
||
connectDatbase(); | ||
|
||
app.use("/api/v1", router); | ||
|
||
app.use(errorHandler); | ||
|
||
app.use((req, res) => { | ||
res.status(404).json({ success: false, status: 404, message: "Not found" }); | ||
}); | ||
|
||
const port = process.env.PORT || 3000; | ||
app.listen(port, () => { | ||
console.log(`The server connection is now established and running on port ${port}`); | ||
}); |
Oops, something went wrong.