Questions tagged [express-router]

ExpressRoute is a service that enables you to create private connections between Azure datacenters and infrastructure that's on your premises or in a colocation environment.

265 questions
0
votes
0 answers

can i store json data in array everytime that i refresh the page

when I go back in previous route I get an error in this line meals = data.meals.map(meal => meal);: Type Error, Cannot read property 'map' of null request(options, (error, response, body) => { const data = JSON.parse(response.body); if…
0
votes
1 answer

Can't get express-router working receiving error when getting page

I have been trying to use router to standardize my code a little bit, but now that I have everything implemented I don't seem to be able to get it working. No errors are thrown in the IDE, but when loading the website i get Cannot GET / App js…
0
votes
1 answer

Regarding not able to get all the registered routes in node

I have used express router for us routing in my app now i want to get list of all the registered routes but not able to get it I have used route as follows global.router = express.Router(); app.use('/api', require('./routes')); I have declared…
Nitin
  • 881
  • 2
  • 10
  • 37
0
votes
1 answer

express Router passing passport.jwt middleware

I know I can pass passport.js as a middleware to express router with this structure: router.post( '/users/update', passport.authenticate('jwt', { session: false }), UserController.updateOne ); but, I need to use blow structure for…
Babak Abadkheir
  • 2,222
  • 1
  • 19
  • 46
0
votes
1 answer

How to implement a MongoDB sort when using express router

I am trying to use one of MongoDB's default sorting algorithms within a Model.find(), however I cannot figure out how to implement the sorting feature in this way. I know how it works and how to use it in the mongo command line but cannot figure out…
0
votes
0 answers

How can my client get application configuration from the server when using Webpack?

I'm adding Webpack to a Node/Express app that previously used RequireJS. When the client needed some configuration from the server, we previously used a custom Express route that retrieved specific configs as JSON: server/index.js - Set up Express…
Matt
  • 23,363
  • 39
  • 111
  • 152
0
votes
1 answer

Why is req.route showing previous route

I have const router = express.Router(); router .route('/:id') .delete( validate(messageValidator.deleteById), MessageController.deleteById, ) .get( validate(messageValidator.getById), MessageController.getById, …
A.Blanc
  • 403
  • 1
  • 6
  • 15
0
votes
1 answer

Using object destructuring to require() Express Router

This code works: const express = require('express'); const Router = express.Router(); Router.get('/hello-world', (req, res, next) => { res.send("hello world!"); //works great }); But…
0
votes
1 answer

Routing url parameters question: the server responded with a status of 404. Node Express Router

I'm using Node.js and Express and I'm getting an error that says this: Failed to load resource: the server responded with a status of 404 (Not Found) [http://localhost:3000/recentbroadcasts/12-10-2018] It was working, and then I tried to add a date…
0
votes
0 answers

Stop Angular 2 from overriding express routing

I'm totally stumped as to why this is happening and can't seem to find the answer anywhere. Basically, my '/' request is never getting to my node.js server (using express) and is automatically sending my index.html file. When I created my Angular 2…
0
votes
1 answer

Can't validate token in middleware JWT EXPRESS

I have a problem with the validation of JWT tokens. When I make a GET request from postman the validation isn't working. The request can work with no token. The question is what if I want to use this validation on middleware? What's wrong with my…
0
votes
0 answers

Why is my react router not passing my express route to server?

I tried to add social login to my (already working) react/express app, and I got it working in localhost. However, when I deploy it to production, the social login doesn't work. This is how it gets started
newman
  • 6,841
  • 21
  • 79
  • 126
0
votes
1 answer

API request handled by incorrect Express router

We are creating a NodeJS application using express framework. While working with router params we encountered a unexpected behavior. API is being tested in postman as we don't have the frontend ready. There are two API defined as below var router =…
James Shaji
  • 316
  • 5
  • 17
0
votes
1 answer

How to use multiple route to invoke same method in express.js?

Right now I have two routes, invoking the same method. Let's say the method's name is myMethod And two routes are / and /:params router.get("/", myMethod); router.get("/:param", myMethod); Since in both cases I have to invoke the same method, I…
Shams Nahid
  • 6,239
  • 8
  • 28
  • 39
0
votes
1 answer

Dropzonejs and Node/Multer photo uploads are not showing on the server.

Using DropzoneJs to upload files to a Node server using Multer, I am unable to save files nor see anything in the req.file or req.files object in the console. Here is the HTML, with a sprinkle of EJS:
illcrx
  • 774
  • 1
  • 12
  • 32