UNPKG

mern-starter

Version:

A starter boilerplate for any of your MERN based project.

24 lines (19 loc) 595 B
const express = require("express"); const cors = require("cors"); const mongoose = require("mongoose"); const app = express(); require("dotenv").config(); // mongodb // mongoose.connect( // "mongodb+srv://Admin:admin@cluster0.7vmqc.mongodb.net/<dbname>?retryWrites=true&w=majority", // { useUnifiedTopology: true } // ); // mongoose.connection.once("open", () => { // console.log("Mongodb is succesfully connected"); // }); const port = process.env.PORT || 5000; app.use(cors()); app.use(express.json()); app.listen(port, () => { console.log("Server is running on port:", port); });