Skip to content
Snippets Groups Projects
Commit 2946f8f6 authored by Guz, Rafal P (UG - Comp Sci & Elec Eng)'s avatar Guz, Rafal P (UG - Comp Sci & Elec Eng)
Browse files

Connected to mongodb and started work on comment routes

parent b629713b
No related branches found
No related tags found
2 merge requests!8CI/CD,!4Comments service
CONNECTION_URL=MONGO_URL_HERE
\ No newline at end of file
import express from 'express';
import cors from 'cors';
import mongoose from 'mongoose';
import bodyParser from 'body-parser';
import dotenv from 'dotenv';
import commentRoutes from './routes/comments.js';
dotenv.config();
const app = express();
app.use(bodyParser.json({ limit: "30mb", extended: true }));
app.use(bodyParser.urlencoded({ limit: "30mb", extended: true }));
app.use(cors());
app.use("/comments", commentRoutes);
const PORT = 5003;
mongoose.connect(process.env.CONNECTION_URL, { useNewUrlParser: true, useUnifiedTopology: true })
.then(() => app.listen(PORT, "0.0.0.0", () => console.log(`Comments service running on ${PORT}...`)))
.catch((error) => console.log(error.message));
mongoose.set("useFindAndModify", false);
\ No newline at end of file
import express from 'express';
const router = express.Router();
export default router;
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment