Paga en 4 cuotas sin intereses de $52.25

Antes:$249

Currency
$209

Paga en 4 cuotas sin intereses

Paga en 4 cuotas sin intereses
Suscríbete

Termina en:

18d

01h

28m

45s

1

Crear un server básico y conectar a mongo

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 }));
[//app.use](//app.use)(router);
router(app);

app.use("/app", express.static(“public”));

app.listen(7000);
//db file ------------------------------------------------------------------------------------const db = require(“mongoose”);

db.Promise = global.Promise;

async functionconnect(url){
await db.connect(url, {
useNewUrlParser: true,
});
console.log(“Conected”);
}

module.exports = connect;
//---------------------------------------------------------------------------------------------------------------------//-----------------------------routes file---------------------------------------------------------------------------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;

Escribe tu comentario
+ 2