Questions tagged as 'express'

1
answer

Sum of values Nodejs + Mongoose

I need to sum the values stored in a variable in the database. I have a form and I want to know the total value generated in a variable. Then I did the following: _.each(cliente.data, function (data) { fo...
asked by 01.09.2015 / 14:45
1
answer

How to separate the errors of a query into an api expressjs

What is the correct method of separating errors from a query? The current code compares the error manually with the message generated by mysql, in case the query can go wrong for several reasons, instead of returning a log and error 500 like...
asked by 11.10.2018 / 21:12
1
answer

export json file

I'm using nodejs, mongoose. No controllers at the end I give res.json(clientes); and in my route I create: app.get('/clientesjson/:id', isLoggedIn, cliente.clientesjson); I need to access my Json information by ID. In the cu...
asked by 16.06.2015 / 22:28
1
answer

Remove timezone on request with node.js and express.js

I have API with node.js and express.js . In the database the fields of type datetime are saved correctly, but in the response of a request GET the date fields come with 3 more hours due to the time zone. I am...
asked by 02.10.2017 / 16:53
1
answer

Search for id Mongo

Hello everyone, I'm following the Getting Mean book but I came across a problem I can not solve. I have a document that I show below collecting data from Mongo, and in it I have subdocuments in the case reviews where I want to get the id....
asked by 22.09.2017 / 14:49
1
answer

Node.js and Express - TypeError: Can not read property

I'm getting the following error in the console: TypeError: Can not read property '_id' of undefined I'm reading the book "Mean Full Stack Javascript ..." from the code house. During the development of the application presented in the book, I...
asked by 30.07.2016 / 06:49
1
answer

Get information from a url using node + express + ejs

I have created a url in the following format: localhost:8080/forgetPassword/id/hash I have this route rendering: app.get('/forgetPassword', function(req, res) { res.render('pages/forgetPassword'); }); So I would like to target...
asked by 11.08.2016 / 18:29
1
answer

Compare multiple arrays

I have two arrays, which are: data [ 0{ nome: a numero: 2 } 1{ nome: b numero: 3 } 2{ nome: b numero: 3 } 3{ nome: b numero: 8 } ] dataNota[ 0{ nf:...
asked by 03.05.2016 / 22:05
2
answers

Sum of number of records per year and month

I need to generate a Json file that will feed a graphic. I need to load the following information. I have a form that receives date (dd / mm / yyyy). My chart shows the number of visits per year x month. I make the following conference in...
asked by 01.09.2015 / 19:43
1
answer

req.body does not work on Express

I'm trying to read parameters sent via post, but express only shows in empty console.log objects. This is the code import * as jsonServer from 'json-server' import {Express} from "express"; import * as fs from 'fs' import * as https from 'h...
asked by 31.08.2018 / 18:00