Skip to content
Advertisement

Tag: express

req.query is empty and req.url is not complete using react router and express

When the page URL is http://localhost:3000/verify?token=something and I make a GET request using fetch, when I hit the server, req.url is “/verify” instead of “verify?token=something”, also the req.query object is empty The client is running on port 3000 and the server on port 5000. I’m using a proxy in package.json on the client-side. Have been scratching my head for some

The HTML file dont hit the CSS file

I am beginner in express, js and node.js I have followed lot of tutorials about express, and i dont understand why the index.html file dont call the corresponding CSS file: my server.js file: my index.html file: my CSS file: and the different folders of the project: when i type localhost:8081/0, the result is not the right result, the CSS is

How to parse NEL (Network Error Logging) errors reported through Report-To header endpoint?

I am using the library Network Error Logging to add NEL header and report-to to add Report-To header on my Express.js server. My code is like More info about them can be found at https://www.w3.org/TR/reporting/ https://www.w3.org/TR/network-error-logging/#network-error-reports https://scotthelme.co.uk/network-error-logging-deep-dive/ I was using use https://report-uri.com to collect NEL errors before and it works well. It collected different kinds of NEL errors as the

Error: Route.get() requires a callback function but got a [object Undefined] at app.js

I dont know why off this error I have another model and almost the same route and the controllers but is not working this is the message: Error: Route.get() requires a callback function but got a [object Undefined] at Route. [as get] (/Users/ediechavero/Documents/Recipe-API/node_modules/express/lib/router/route.js:202:15) at Function.proto. [as get] (/Users/ediechavero/Documents/Recipe-API/node_modules/express/lib/router/index.js:510:19) at Object. (/Users/ediechavero/Documents/Recipe-API/routes/places-routes.js:22:8) at Module._compile (internal/modules/cjs/loader.js:1156:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) at Module.load (internal/modules/cjs/loader.js:1000:32)

Not Found when serving express static file

I would like to access to a page of my web application. I created the server with expressJs and I serve the route by using app.use(express.static()). Here is my tree : In the app.js file, I have this : The line app.use(‘/MPS’, express.static(__dirname + ‘/client’)); work fine : when I go to http://localhost:8080/MPS the page index.html is displayed. But when

Advertisement