const express = require(“express”);
const bodyParser = require(“body-parser”);
constapp = express();
constdb = require("./db");
const router = require("./network/routes");
db(
“URL de la connection de mongo”
);
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended: false }));
[
router(app);
app.use("/app", express.static(“public”));
app.listen(7000);
const db = require(“mongoose”);
db.Promise = global.Promise;
async functionconnect(url){
await db.connect(url, {
useNewUrlParser: true,
});
console.log(“Conected”);
}
module.exports = connect;
const end = require("…/components/message/network");
const user = require("…/components/user/network");
const chat = require("…/components/chat/network");
const routes = function(server){
server.use("/end", end);
server.use("/user", user);
server.use("/chat", chat);
};
module.exports = routes;