Skip to content

Commit

Permalink
First Commit: Implement All Endpoints for the Task
Browse files Browse the repository at this point in the history
Description: This commit completes the implementation of all the necessary endpoints for email scheduling and updation, deletion, findOne, findAll
  • Loading branch information
abdul-vajid committed Aug 3, 2023
0 parents commit 4e29d0a
Show file tree
Hide file tree
Showing 17 changed files with 2,393 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/node_modules
.env
6 changes: 6 additions & 0 deletions .sample.env
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=
32 changes: 32 additions & 0 deletions app.js
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}`);
});
Loading

0 comments on commit 4e29d0a

Please sign in to comment.