Questions tagged [express]

Express is a minimal and flexible Node.js web application framework, providing a robust set of features for building web applications. https://expressjs.com

0
votes
0answers
4 views

Managing online users on server without using websockets

I would like to show a list of connected users without using Websockets. I thought to use http header Connection:keep-alive to get persistent connections. Then, when clients leave the website, they ...
0
votes
0answers
15 views

Rest API Patch only 1 field at a time

I'm working on an inline grid editor that calls an express rest api after a single value in the grid is updated. So when a user changes a single field in the grid, I am calling a PATCH request to ...
1
vote
1answer
8 views

Using express-pino-logger and pino-pretty together

I'm have existing code that uses express-pino-logger. This words great with our ELK stack setup, but is pretty unfortunate (logs minified JSON) when running locally. I'd like to use pino-pretty to ...
0
votes
1answer
35 views

How do i implement callback/await to my code?

So, I have been working on this code for the past few days and tried to implement callback/await/whatever is needed to no avail. The question is, how do I wait with the response until I get let's ...
0
votes
1answer
21 views

React.js: Raw HTML string does not gets recognized as HTML elements from Node.js

I am sending a raw HTML from node.js to react. and It was successful. However, when I try to render it, they are render as raw string as opposed to HTML elements This is how I get the string from ...
0
votes
0answers
8 views

Reload express server before some mocha tests E66+

I am building some API endpoints using node/Express and have some problems testing the endpoints. The problem is that the server needs to be restarted (to clear data stored in memory) between tests. ...
0
votes
0answers
6 views

Server sent response but Client not loading the sent content

I have simple node server (nodejs + express + ejs rendering), when user tried to load a particular page server sends that compiled html and sends that in response. In order to track users I have ...
-1
votes
1answer
17 views

How to remove data from multiple collections in express js?

I have created three collections, family {familyname , _id} root {rootname familyId _id} child{childname rootId familyId _id} Now if I delete family, root, and child should also be ...
-1
votes
1answer
13 views

How to delete records from multiple collection by id in express js?

I have created three collections, family {familyname , _id} root {rootname familyId _id} child{childname rootId familyId _id} Now if I delete family, root, and child should also be ...
0
votes
0answers
24 views

How to send react error to server and log it?

I'm trying to send react errors that was catched by react ErrorBoundary or my own creacted errors to server and log them, but don't know how to do it right and simple. On my express server i log ...
0
votes
0answers
23 views

Unable to push object into array in Mongodb collection but Id is inserted

I am using comment array in my schema as fallows. I want to push comments data into that comment array using nodejs api var Schema = mongoose.Schema; var myfeeds = new Schema({ title: { ...
0
votes
0answers
20 views

Why a rejected parameter of a promise works outside of its scope?

See, a promise have two parameters resolved and rejected. So by calling then, you are passing it 2 parameters. router.route('/issue/add').post((req,res) => { let issue= new Issue(req.body); ...
3
votes
1answer
13 views

Get this error auth/operation-not-supported-in-this-environment using express nodejs

I'm working with Firebase in my project but getting this error auth/operation-not-supported-in-this-environment when login with google credentials. .hbs file code <span class="google-bg session-...
0
votes
1answer
10 views

Node.JS improve cassandra performance

So currently I have an application which uses cassandra. I have 3 cassandra nodes of which 1 is seed node. The app currently takes in around 100 write requests every 20 seconds and around 200 read ...
0
votes
1answer
15 views

NodeJS: Axios Post request with multipart file

I have a backend service that expects a file, and in turn makes an API call to a gateway, using Axios. I want the file to be attached to the call to the API gateway, but I have not been able to come ...
0
votes
1answer
17 views

How to deal when calling a wrong endpoint using app.get?

I have several endpoints defined. I am doing the automation of all of them and in addition defining some scenarios where I should get an error. For instance, one of the endpoints is: '/v1/templates'. ...
0
votes
0answers
6 views

Google drive api 3.0 download file using NodeJS Express restful API into PostMan

I am struggling to get my download API work as expected. I am using NodeJS and I am able to list and upload files to folders I create through my API. My goal is to get the binary data from google ...
1
vote
7answers
84 views

Why is there a dot after a function call in Javascript?

In express.js, why is .Server(app); valid as a statement? var http = require('http').Server(app); Isn't require() a function, and not an object?
0
votes
1answer
12 views

Postgraphile + express + jwt is throwing 'No authorization token found' even though graphiql works

I am trying to use the jwt express middleware as well as the postgraphile middleware together, and I want to add an exception for having an auth token to the graphiql interface. I know that ...
-1
votes
0answers
12 views

Web-based file manager nodejs

i've tried researching and finding ways to make it work, i'm trying to find Web based File Browser using NodeJS/ExpressJS/Javascript. I am doing a simulation with 2 VMs where the host is able to ...
0
votes
0answers
22 views

How do I concatenate a string in handlebars view

I wrote a helper function to help me format URL, which is the combination of some object attributes. How do I concatenate this attribute in handlebars view? Helper function const url = (link)=>{ ...
0
votes
1answer
23 views

Callback function fires in both success/error cases

I have a Nodejs/Express API using Mongoose and Mongo. I have a function that does an update. The update works, but for some reason, it also always logs an error. Here is the block of code I'm ...
0
votes
1answer
13 views

Does Axios support Set-Cookie? Is it possible to authenticate through Axios HTTP request?

I'm trying to authenticate express API back-end using Axios HTTP request call. I was able to see 'Set-Cookie' in the response header, but cookie was not set. Is it possible to set cookies through ...
0
votes
2answers
14 views

How to send the contents of multiple MongoDB collections to a route for rendering using express?

I have two mongoDB collections (players and opponents). I want to send the contents of both of them to the same route so I can use the values in different contexts. I am using the following code but ...
1
vote
1answer
24 views

sequelize: relations in both directions needed?

I have two existing tables in my database: "user" with the columns "id" and "depId" and "department" with "id" and "name". (user.depId ist the foreign key for department.id) Now I'd like to create a ...
0
votes
0answers
12 views

Why can't I transmit a file to my Express API?

I'm trying to create a simple file uploader that stores images on a Google Cloud Storage bucket. Here's how I send the file: const data = new FormData(); data.append('image', this....
0
votes
1answer
14 views

passing json formatted with information from multiple json documents nodeJs

I have a function where I would like to return an arrays of JSON objects with the necessary information. to send directly to the front everything ready. async listProcessByOffice(req, res, next) { ...
1
vote
1answer
27 views

DRY - How to make 2 GET functions that takes different tables into 1 GET function

In my REST API i have nearly 2 nearly identical functions. How to make it 1 that is changing based on what i pass in url? app.delete('/tourists/:id', (req, res, next) => { pool.connect(function ...
0
votes
1answer
40 views

How to iterate over an array inside an object (handlebars)

I am trying to iterate over an array that is part of an object. Below is my user schema var UserSchema = new Schema({ username: String, email: String, password: String, company: ...
0
votes
0answers
11 views

Connecting Mongoose to MLab H10 503

I'm getting an H10 error with my node app on Heroku. It was working fine until I added Google analytics to my EJS files. My env port is set fine, the only other thing I think it could be is my ...
-2
votes
1answer
18 views

Unable to connect to WAMP router on the client side of my application

I'm building a web interface to an IoT device that will change the settings of the device. The tech stack that i'm using is as follows: - React.JS for the front end client - Node.js for the server -...
-2
votes
1answer
22 views

Decrementing a field of type number in mongodb and nodejs

I'm learning mongodb. I have a collection called item which has a field piecesLeft of a type Number, and I want to decrement this field value when a user orders this particular item. Any help?
0
votes
1answer
21 views

Azure Node.js Internal Server Error from index.js file

I have a Node.js app working locally, however I have spent quite a while trying to figure out how to deploy it on Azure through countless tutorials and official guides. However, I keep on receiving ...
0
votes
1answer
16 views

Can't login a user using bcrypt (dyld: Symbol not found)

When I try to login a user using bcrypt.compare to compare passwords, this error message show up in my terminal. dyld: lazy symbol binding failed: Symbol not found: ...
1
vote
2answers
56 views

How to send response in mid of multiple async calls to database in NodeJS?

Need to terminate POST function and send Error: something as response, without terminating program. Sample for-loop: for (let i = 0; i < req.body.listoftouristsbyid.length; i++) { client.query(...
0
votes
1answer
33 views

NodeJS MongoDB processing and storing huge amount of text

I have a NodeJS Express APP and I am building an endpoint to update Terms&Conditions http://127.0.0.1:3000/api/admin/info/terms/de?version=2 However the text I'm trying to store is way too ...
-2
votes
0answers
9 views

Difference between express middleware and express gateway

Can someone pls explain the Difference between express middleware and express gateway. I have been using the express middle ware for routing and security, and as per my reading express gateway is ...
1
vote
0answers
24 views

Refused to apply style and 404 Error using Express and React build

I am trying to serve my React app via an Express server with the following code: // server/app.ts app.use(express.static(path.join('/home/bram/Documents/Tool/build/', "static"))); app.get('/', (req, ...
1
vote
1answer
37 views

Express Node JS POST. How do I add values to my req.body without using url parameters

I'm building a rest api using Express NodeJS with mysql. I'm having no issues at all using GET and using req.params.value and passing values using URL parameters. Now I'm trying to use POST to ...
0
votes
0answers
18 views

“Unresolved variable or type data…” warnings when using EJS IntelliJ

I'm learning Node.js with express.js. I'm used EJS Template engine. Everything looks like working fine, but I have these weak warnings in IntelliJ.."Unresolved variable or type data...". How can we ...
0
votes
3answers
42 views

Express: can I use multiple middleware in a single app.use?

I have a lot of apps full of boilerplate code that looks like this: app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: false })); app.use(cookieParser()); app.use(require('express-...
0
votes
0answers
13 views

What authentication strategy to use in express/apollo e-commerce API

Currently developing an API in node.js/express/Apollo for an eCommerce website. I'm struggling to decide which authentication strategy to use. I've mentioned passport because I have experience with ...
1
vote
1answer
18 views

vscode warning on first arguments being unused, but I use later arguments

Here's some basic code from express generator: // catch 404 and forward to error handler app.use(function(request, response, next) { next(createError(404)) }) vscode complains: 'request' is ...
0
votes
1answer
19 views

JSON.parse Unexpected Token xmlhttprequest and node.js

I'm trying to send a number from a javascript file to a node.js server (with express and body-parser modules installed), do a small calculation and return the result, updating an html field. I get the ...
2
votes
1answer
33 views

Another “can't set headers after they're sent”

I get a "can't set headers after they're sent" error, which I understand may be due to sending a response from my server more than once, however it doesn't seem to be the case with my code, at least ...
0
votes
1answer
20 views

GET a string inside a object nested within a array

I have a get router that gets orders with the time stamp router.get('/api/order/:date/:time', function (req,res,next) { Box.find({orders: {date:req.params.date}}.then (function (order){ ...
0
votes
2answers
45 views

Search for multiple words in string

I couldn't find the answer I was looking for at this challenge. I'm using express in my back end and I'm trying to build a route to filter the results based on user input. Here's what I have so far: ...
0
votes
0answers
19 views

Connect the mongo db LearningLocker_v2 using express and xapi with vtc-lrs package?

I am new to xapi and i don't know to integrate the mongo db with the usage of express and vtc-lrs package. Here i am use the following link for reference npm package link My code is: var express = ...
0
votes
0answers
8 views

Node Js Form Data Not In Array Format

I am passing form data in array type but not getting in array format in node, express. Please check this. This is req.body response { is_sticky: 'yes', is_active: 'yes', ...
2
votes
0answers
28 views

Check all data in every 10 second in MongoDB

There is cases collection which stores cases.Each case is being assigned to 5 users from user collection to evaluate the case let's call them assigned Users.These assigned users are stored in an array ...