Most voted "express" questions
Express is a minimum framework for Node.js web applications that provides a set of features for web and mobile applications.
Learn more…400 questions
Sort by count of
-
1
votes1
answer828
viewsHow to Save and Recover Images in Base64 using Mongoose in a Nodejs Service?
I need to save and recover an image in Base64 through a REST service developed with Nodejs. For this, I have created the following schema on Mongo: const userSettingsSchema = new Schema( { 'avatar':…
-
1
votes0
answers60
viewsHow to get the X-Forwarded-For (IP) header from Passport
I’m using express to create route for my application. To login I have a route to authenticate using Passport and Passport-local. I need to compare the user access IP with the IP of the user that was…
-
1
votes1
answer1128
viewsPass parameters on express redirect + Node + ejs
Hello, I want to pass parameters in redirect the same way I do in render method, I need it redirect because I do not want to render a page but redirect to the API route that is already rendering the…
-
1
votes2
answers164
viewsNode.js server error (ejs)
hello I have that code: router.post('/loginCli', function(req, res, next) { var j; conn.query('SELECT * FROM bdlabella.tbclientes order by email_cli', (err, results) => { if(err){…
-
1
votes0
answers42
viewsHttprequest using Angularjs, Nodejs and Express
I’m new to these technologies and I’m trying to make an http call (get and post) via html but it’s giving error, I’ve seen several topics here and elsewhere but I can’t make it work. Someone can…
-
1
votes2
answers268
viewsPass controller data to EJS
I need to pass the obtained data, by a query in the database, to my EJS template in order to manipulate these values. My current code is like this router.get('/devreport', redirectLogin, (req, res)…
-
1
votes0
answers52
viewsHow to change the state of a variable using Express and EJS?
I am trying to implement a Loader in my application as follows: 1 - seto a variável isLoading para true 2 - faço as requests 3 - seto a variável isLoading para false With this variable I can make an…
-
1
votes1
answer1551
viewsError handling in js Node
I’m doing an error treatment that if a wrong id is passed by url he returns a error 400, but when I take the test it returns a error 200 one more message "error": "Error", "message": "Cast to…
-
1
votes0
answers105
viewsAutomate express response function (res.send())
I have an express api and would like to develop a function to standardize the customer response. Code (running the function): response(200, "Evento adicionado com sucesso!", res) Scope of function:…
-
1
votes1
answer1924
viewsRequest is presenting Cross-Origin Request Blocked in Reactjs app
I am developing an application in React and previously created a restful API with Node and express, in my api I added the module Cors const cors = require('cors'); and added it at the boot of the…
-
1
votes0
answers58
viewsHow can I redirect my user to another screen by passing a HEADER with Nodejs
I’m doing the authentication/authorization part of my application, and I need to pass through my screens always passing the TOKEN through the HEADER, but I can’t redirect my user passing the TOKEN…
-
1
votes1
answer383
viewsMongoose is updating wrong object in mongodb
I have a problem saving the data in mongodb. Context I have an express api that listens to requests to save the data to the mongodb an application sends. This data is related to APP page views,…
-
1
votes2
answers46
viewsI’m not passing any data on the request but it seems that some information is coming
I have a method index that returns places (houses/apartments) registered on the site. It is possible to filter by location and key characteristics if the person wants. If you do not want, I return…
-
1
votes0
answers318
viewsHow to hide error message coming from an API using Ajax, Fetch or Axios
Good evening guys, I’m beginner with Javascript, and I’m developing the functionality of a CRUD, I want to use the correct HTTP verbs for each function (Obs: I know that using the HTTP verbs is only…
-
1
votes1
answer648
viewsAssociations with Node.JS / Sequelize
Good evening dear friends, I’m developing an API with Node.JS / Express / Sequelize and I need some help. As it is the first time that I use relational databases with Node, I don’t know exactly how…
-
1
votes2
answers55
viewsGET request equivalent in separate files (controller and route)
Good night! Working on a project, and on the login screen after performing the authentication (Passportjs), the user will be redirected to the home page. However, a little while ago I started to…
-
1
votes1
answer56
viewsHow to call a function within function?
I’m developing a API, and in it I need to implement a method that seeks within my database a film through your ID. As I will use this method to perform more than one time, I would like to reuse it…
-
1
votes1
answer186
viewsHow can I inject a standard script into my HTML files using Node.js?
I am creating a server with Express in Node.js where each HTML page is different but has the same Javascript code on <head> of the document. What I want to do is write this Javascript code…
-
1
votes0
answers37
viewsWhat is the difference between HTTP server and HTTPS considering my structure?
I have a js Rest Node application running behind a proxy Reverse by Nginx, with https properly configured, where the server is configured as follows: Obs: app is my router. const httpServer =…
-
1
votes2
answers454
viewsError when creating a bank with Sequelize
Opa, I am creating a Rest API in Nodejs and using Sequelize as ORM only when I try to use the db:create command of the sequelize to create the database, it returns me this error: ERROR: Dialect…
-
1
votes1
answer103
viewsHow to access json Response fields in nodejs?
I’m studying a little bit about nodejs and am facing difficulties to capture and access json Sponse, For example: My Getbyid exports.getProduto = function(req, res) { const produtoId = req.params.id…
-
1
votes1
answer158
viewsReceive Nodejs post form returns Undefined
I am learning socket.io developing a chat and etc. What happens is that on the login page I am creating I am not being able to receive input data. <!DOCTYPE html> <html lang="pt-br">…
-
1
votes1
answer361
viewsStreaming videos with Nodejs
Good morning! I have a REST API running on Node with Express, and the frontend running Vuejs. The API returns me a list with the name of some videos that were previously stored in an Storage, and a…
-
1
votes2
answers216
viewsExpress - req.body does not find the data sent by the customer
I have a small form with login and password whose data I need to be sent to a route X via POST. For this, I used AJAX and to make sure that the data was being sent, I used the Success function to…
-
1
votes0
answers44
viewsProblem with asynchronous call
Good evening guys, all right? I’m in a boring situation and I don’t know how to fix it... The thing is, I’m developing an API to bridge the data that’s in a database to a third-party system, which…
-
1
votes1
answer52
viewsTreat req.files as null
Good night. I’m starting now with studies in web development and would like to know how to treat the following:What I developed was a blog, and in the area of creating posts, there is a form for you…
-
1
votes2
answers64
viewsHow to redirect to another page, using the query that went to the previous page?
I’m with an application that when the person registers, he plays to a page and after 3.5s he redirects to the other page, but I wanted him to redirect with the query I need, to already appear the…
-
1
votes1
answer57
viewsError in useEffect accessing API data
I have the following hook that runs the API calls smoothly, returning the information and updating the components normally, but it brings some connection errors in the console, I believe these…
-
1
votes0
answers30
viewsIs it possible to find out the length of an audio by requesting the Express?
Hello, all right? I am developing an application in Node.js with Express that has as one of its functions to receive an audio file and store the file information in the database. I am passing this…
-
1
votes0
answers26
viewsDisplay sequelize related table result
Good would like the help of you gentlemen, I have two tables customer and product a customer may have several products and one product belongs to only one customer, I have a relationship using…
-
1
votes0
answers139
views"Cannot POST" error
My code makes the mistake: Cannot POST /save-Institution when I click send in the form server.js: const express=require('express'); const path=require('path'); const pages=require('./pages.js');…
-
1
votes1
answer86
viewsHow do I return a req.body.variable in a Express Rest api in a POST method?
When I try to return one req.body.qualquerVariavel acquired through a POST method, the return is undefined, and if I put the API to show on the console, it shows the value correctly, I wanted to…
-
1
votes1
answer465
viewsHow to redirect to another route and pass variables in the process? Node + Express
I would like to redirect using res.redirect() so that the URL is also changed, but I’m not being able to send information in the process, could anyone tell me how to do that? I want to send together…
-
1
votes1
answer360
viewsSend Formdata with Fetch API
I’m trying to send a Formdata() to the backend via Fetch API, but I can’t read the form inputs in NODEJS. By the way, req.body is empty. I’m wearing the body-parser and express. Backend: const…
-
1
votes1
answer765
viewsTypeerror: Cannot destructure Property `name` of 'Undefined' or 'null'
I’m using jest along with supertest to test my application endpoints. The tests with the get requests are working, but the test with the post request is giving error: clientRoutes.test.js const…
-
1
votes1
answer37
viewsThe property this is returning Undefined in typescript
hello! I have this code typescript: import { InternalService } from './../services/InternalServices'; import { Request, Response } from "express"; class InternalController { internalService = new…
-
1
votes1
answer31
viewsBody of the request (req.body) returning empty object when submitting form
I have basically two files. HTML, so: <form action="/result", method="POST"> <input id="phrase" type="text" name="phrase" value="Processar frase" /> <input type="submit"…
-
1
votes0
answers18
viewsError Express: 'Error: Failed to lookup view "index" in views directory'
I’m trying to set my default folder of the views but something is going wrong because it does not find the views... By the error that returns it seems that he is fetching them in the wrong folder.…
-
1
votes0
answers13
viewsFormat date field to display on the EJS page with Node.Js
I am using Node.JS to retrieve data from a Mysql table, but I would like the date field to be displayed in the EJS view in the "DD/MM/YYYY" format. Showing "Thu Jul 15 2021 18:00:00 GMT-0300…
-
1
votes0
answers35
viewsIs it possible to integrate the express-Validator with the multer?
I am developing an API for study and in this API I have the functionality to add a vehicle, in which I recover the data passed by the user and an image. But as I am using the express-Validator,…
-
0
votes1
answer1869
views -
0
votes0
answers67
viewsNodejs - socket.io error : xhr-Polling
I’ve got a nasty J server set up this way: var express = require('express'); // CHAMADA DA API EXPRESS var app = express(); var server = require('http').createServer(app); // CHAMADA DO HTTP var io…
-
0
votes1
answer955
viewsHow to organize the REST API and website frontend?
I am creating a Single Page Application site, for this, I created a Restful API on Node.js that does all the actions in the database, login, sending emails and etc. I thought of creating a "public"…
-
0
votes1
answer464
viewsFind in two Customers using Aggregation
I need to perform a find on two Collections in mongodb using Aggregation and place the results in a single array. I’m trying to do it this way, but it doesn’t work. I have Visiting and Opportunities…
-
0
votes0
answers320
viewsExternal redirection on express
Galley, How do I change this line of my code: app.use(express.static(__dirname + '/public')); For 1 external redirect, for example redirect to http://www.google.com…
-
0
votes1
answer7482
viewsWhat’s the expressjs for?
What is it, what is it for and how does express.js work? It is recommended to use it together with Angularjs in a SPA app?
-
0
votes2
answers117
viewsHow to install the express in Ubuntu via npm?
When I try to install the Express in the Ubuntu, with the command npm install express, this error occurs: npm WARN enoent ENOENT: no such file or directory, open '/home/flavio/package.json' npm WARN…
-
0
votes1
answer115
viewsmodule.Exports mount an array with the api data
Well I’m having the following problem is I’m not getting it at all. Well I have a script config.js module.exports = { "adsense": { "bloco728x90": { "google_ad_client": "ca-pub-x", "google_ad_slot":…
-
0
votes1
answer295
viewsres.redirect does not redirect in expressjs
I am the nodejs along with the expressjs and in the submission of a form a request is made on the server, which after processed, redirects the page: ... Post.create(doc, (err, post) => { if (err…
-
0
votes1
answer85
viewsAPP nodejs: prevent logs in terminal window
I created an application in Nodejs with Express and when I put this application to run (with npm start), There are some logs appearing in the terminal window where I am connected to each page that I…