Questions tagged as 'express'

1
answer

Problems when ordering an array in javascript and a chat that I am creating

I'm creating a chat with sockets on nodejs that say it's very good. Then I create an array: let nicknames = []; that will save the names of users so that later the frontend will be in charge of showing them in a list. That works perfect for...
asked by 23.07.2018 / 05:24
1
answer

How to get the latest registration | mongoDB | Nodejs

I am developing a small project and I have a very simple question, if I have in DB a few records, for example these: { { 'name':'nombre1', 'edad':'22' }, { 'name':'nombre2', 'edad':'23' }, { 'name':'nombre3', 'edad':'24' }, }...
asked by 14.03.2018 / 02:15
1
answer

What is the correct way to send several datasets in the response using Nodejs and mssql?

Good morning everyone, I have a web application made in Nodejs, in one of the requests I must send two sets of data, which are retrieved independently from a Microsfot SQL Server database. My query is the following Is this the correct way? fun...
asked by 02.02.2017 / 17:12
1
answer

I need help with a Query on a Backend- RestAPI of mongoDB using mongoose

This is the model of the object to which I ask the question const mongoose = require('mongoose'); const userSchema = mongoose.Schema({ _id: mongoose.Schema.Types.ObjectId, email: { type: String, required: true}, nombre: { type: String, requi...
asked by 24.06.2018 / 02:00
1
answer

Nodejs: Can not set headers after they are sent

Good I have an error in Node that I do not understand because it happens: class HomeController { getViewLogin(req, res, next) { if(req.isAuthenticated()) res.redirect('/index'); res.render('singIn', { title: 'Login'...
asked by 13.03.2017 / 17:26
1
answer

I can not get a POST with express (NodeJS)

I started to develop a small cahtbot with IBM technology (Watson), I'm using NodeJS for the development part of the application. I am using Express as a routing framework, I have also divided the project into views, routes and the server. I foun...
asked by 28.08.2018 / 22:40
2
answers

Node -npm start npm ERR! missing script: start

Hello, I'm using Node to make a RESTFUL API. I just found out that now npm uses package-lock.json and I do not know if this changes the way you work with node ... this is my error and my code var express = require('express') var a...
asked by 02.02.2018 / 18:15
1
answer

Does not load CSS on NodeJS server

I have the following basic server: var express = require('express'); var app = express(); app.get('/', function(req, res){ res.sendfile(__dirname + '/public/index.html'); }); app.listen(8081); In that index.html I...
asked by 31.03.2017 / 19:34
1
answer

Error: "Can not set headers after they are sent"

In a controller I am using promises because I perform multiple queries and I want to avoid having a multitude of callbacks, if you do not find a value must send a message to the client and not pass to the next promise. This is my code: va...
asked by 20.01.2016 / 18:04
2
answers

Question about MongoDB and NodeJS

I'm training MongoDB and NodeJS, although I have some doubts. In my APP file I defined the following Here I put my code (do not pay attention to the XD notes) //esta variable almacena las funciones del paquete express, el cuál es el núcleo...
asked by 01.08.2016 / 02:13