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
1 answer

I want to export a value from one file to another in Nodejs

This is my routes.js file const express = require('express'), router = express.Router(), loginHandler = require('../handler/loginHandler'), router.get('^/:userId/:userType/:sessId/:lang/:orgId/:merchantId/:domainId',…
0
votes
1 answer

Express.js: Specifying a root route breaks static file resolvement

I'm trying to make an express.js / react.js app but I'm running into a couple of issues I find no answer for. I set up a base directory that holds the express server, and a subdirectory called client which holds my react application. When I use the…
0
votes
1 answer

Express Router call another route when should return Not Found (404)

how u doing? Here is my code: const router = Router(); router.use( `${routePrefix}/v1/associate-auth/`, associateAuthRoutesV1(router) ); router.use( `${routePrefix}/v1/associate/`, JWTVerify, associateRoutesV1(router) …
0
votes
0 answers

Error in Firebase Cloud functions deploy using express.Route()

I have created firebase cloud functions using typescript and express. When i write routing in index.ts(working code)and deployed on cloud it's working. When I use express.Route() and then try to deploy functions it is giving error. Working: index.js…
0
votes
2 answers

Is there a way to call a function before calling the controllers in nodejs

I have multiple routes defined in my routes file and I want to call a function on every routes before it calls the controller. Is there a way? const express = require('express'); const userController = require('../controllers/user'); const…
Papu Kumar
  • 43
  • 7
0
votes
1 answer

Cannot use TypeOrm with express "connection "Default" not found

I'm currently having a bad time with typeOrm, I don't know why but express is getting initialized before my connection to the database with typeOrm So I get an error "Connection default not found" here's the code Typeorm.config.ts import…
Umbreoon
  • 57
  • 9
0
votes
1 answer

Routing with Express and Vue

I'm making a simple page with an index '/' and 404 to catch errors '/404'. I have the following in my express app: // Entry Point app.use("/", express.static(resolve(__dirname, "client/dist"))); Then this is my router in Vue const routes = [ { …
Herbie Vine
  • 1,643
  • 3
  • 17
  • 32
0
votes
1 answer

There is a real difference in GET, DELETE, POST in express router?

When we write a express server we can set the routes using GET, POST, DELETE, PUT. There is a real difference between then? Or is just a "best practice" thing?
Danilo Cunha
  • 1,048
  • 2
  • 13
  • 22
0
votes
1 answer

How to group express routes like express-group-routes?

I tried with express-group-routes and works very well on my localhost but does not detect any routes when is started on a docker container I have simple code that returns JSON as follows: { "message": "Service Running" } and other routes. The…
0
votes
1 answer

How to create parameters in Express router dynamically?

Existing Code: const express = require('express'); const router = express.Router(); router.get('/data/:d1/:d2/:d3', require('../apifoo').foo); Route: /data/:d1/:d2/:d3 Path: /data/1/2/3 req.params : 'd1' :'1', 'd2': '2', 'd3': '3' But what if…
Artem
  • 17
  • 1
  • 6
0
votes
1 answer

Express next() is triggering next route which is parameterised after next() from current route is called

I have this route, /test which I called but somehow it is triggering /:async route as well when next() is called in /test route's finally? router.post('/test/:value?'async (req, res: express.Response, next: express.NextFunction) => {| try{ …
Helping hand
  • 2,800
  • 2
  • 19
  • 31
0
votes
0 answers

Request interpreted as GET instead of POST in Production ENV [NGINX] [Express] [Node]

I have an express API I built to my production environment. When I call a particular endpoint to POST a new object, I get a response as if I were making a GET request. If I call my development environment url, it works fine. Any ideas on what could…
Ron McCranie
  • 119
  • 5
0
votes
1 answer

why module.exports = { router }; is throwing error while module.exports = router ; is not?

C:\Users\RAHUL\Desktop\2.0 Developer course\YelpCamp\v1\node_modules\express\lib\application.js:210 throw new TypeError('app.use() requires a middleware function') ^ TypeError: app.use() requires a middleware function at Function.use…
0
votes
2 answers

body parser logging empty object in express router

for some reason I can see my req.body in my express server on my route req body is [Object: null prototype] { '{"password":"xxxxxxxx"}': '' } but when I log req.body.password (the object key) I get req body is undefined here's my index router for…
monsterpiece
  • 739
  • 2
  • 12
  • 34
0
votes
1 answer

How can I clear my interval and stop repeated API calls?

I have a form, where upon clicking start, I begin a series of API calls that call on the interval of 15 seconds. When I click stop, I would like to stop the API calls and clear the interval. For some reason, despite me hitting stop and my code…