I am learning node.js, mongodb and [login to view URL]
I have one github code of MVC pattern of node.js and currently i am facing issue of routes and [login to view URL]
[login to view URL] code
const express = require("express");
const cors = require("cors");
const app = express();
var corsOptions = {
origin: "http://localhost:8081"
};
[login to view URL](cors(corsOptions));
// parse requests of content-type - application/json
[login to view URL]([login to view URL]());
// parse requests of content-type - application/x-www-form-urlencoded
[login to view URL]([login to view URL]({ extended: true }));
const db = require("./app/models");
[login to view URL]
.connect([login to view URL], {
useNewUrlParser: true,
useUnifiedTopology: true
})
.then(() => {
[login to view URL]("Connected to the database!");
})
.catch(err => {
[login to view URL]("Cannot connect to the database!", err);
[login to view URL]();
});
// simple route
[login to view URL]("/go", (req, res) => {
[login to view URL]({ message: "Welcome to bezkoder application." });
});
require("./app/routes/[login to view URL]")(app);
// set port, listen for requests
const PORT = [login to view URL] || 8081;
[login to view URL](PORT, () => {
[login to view URL](`Server is running on port ${PORT}.`);
});
[login to view URL] code
[login to view URL] = app => {
const tutorials = require("../controllers/[login to view URL]");
var router = require("express").Router();
// Create a new Tutorial
[login to view URL]("/", [login to view URL]);
// Retrieve all Tutorials
[login to view URL]("/", [login to view URL]);
// Retrieve all published Tutorials
[login to view URL]("/published", [login to view URL]);
// Retrieve a single Tutorial with id
[login to view URL]("/:id", [login to view URL]);
// Update a Tutorial with id
[login to view URL]("/:id", [login to view URL]);
// Delete a Tutorial with id
[login to view URL]("/:id", [login to view URL]);
// Create a new Tutorial
[login to view URL]("/", [login to view URL]);
[login to view URL]("/api/tutorials", router);
};
these routes are not working
i need a freelancer to help me in this and also show how to check [login to view URL] in postman