Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Tomas Wegenast
    This throws me an error saying that its an incompatible type
    But my ContextRequest extends Request, like so:
    export default interface ContextRequest extends Request {
        context: UserContext;
    I have to make context optional: context? to get it work
    Christian Garrovillo

    Hey guys,

    I'm trying to get the full URL of an endpoint, but I'm getting inconsistent results with req.originalUrl, req.baseUrl, and req.path.

    The full path has many subpaths, like http://92cca2557089.ngrok.io/org/us-central1/sms/test

    sometimes originalUrl returns the whole thing: /org/us-central1/sms/test, but often only test
    This is the same behaviour for baseUrl and path

    What gives?

    Lee Wilson

    Hi, not sure if I am misunderstanding something. In the express docs it seems like in one place it says try/catch will not work for asynchronous error handling, but another says it will:


    You must catch errors that occur in asynchronous code invoked by route handlers or middleware and pass them to Express for processing. For >example:

    app.get('/', function (req, res, next) {
      setTimeout(function () {
        try {
          throw new Error('BROKEN')
        } catch (err) {
      }, 100)

    The above example uses a try...catch block to catch errors in the asynchronous code and pass them to Express.

    Here is an example of using try-catch to handle a potential process-crashing exception. This middleware function accepts a query field parameter named “params” that is a JSON object.

    app.get('/search', function (req, res) {
      // Simulating async operation
      setImmediate(function () {
        var jsonStr = req.query.params
        try {
          var jsonObj = JSON.parse(jsonStr)
        } catch (e) {
          res.status(400).send('Invalid JSON string')

    However, try-catch works only for synchronous code. Because the Node platform is primarily asynchronous (particularly in a production environment), try-catch won’t catch a lot of exceptions.

    Hi We are serving a web app using express on https, however we see some of the response headers are being removed and not able to get them. this is a simple express app serving static files. And we are using our Rest Helper method to call rest endpoints
    Miguel Ángel Suárez Calles
    Hello Express Community!... I am, in the request I'm using, producing a JSON file that gets generated, which is about 300MB. But when I try to send it through res.json(result), express just sends a blank response
    1 reply
    I'm not sure what to do... The respond does get sended when talking about a JSON file but about 100MB
    Arseny Yankovsky

    Hello everyone,

    I'm working on an open-source monitoring/tracing tool for JavaScript backends called recap.dev(https://recap.dev). Basically, it will record everything that happens while serving a request (API and database calls, logs, etc) and build a nice timeline so it's easy to find bottlenecks and debug. Think Sentry on steroids for the backend. We have an interactive demo if you'd like to know what it looks like (https://demo.recap.dev).

    I wrote a post outlining the main benefits of using it here: https://recap.dev/blog/5-reasons-to-use-recap.dev

    I'd love nothing more than your honest feedback. Please let me know if that sounds interesting to you. I can help you set it up for absolutely free. Thanks for your time.

    Jon New

    Hi! I've been working on Expresso, a faster drop-in replacement for Express's default router. It also allows routes to be added in an order-independent manner.


    Feedback welcome!

    I have a question
    i want to make a exe of my express app
    we i run it through node. its run awsum
    but when i generate exe and run its through some unknown error
    i used pkg module
    @Games-beep what did you use to generate your "express" exe
    i'm using "pkg" module
    Miguel Ángel Suárez Calles
    Hello Express Community!
    I'm sending a large object using the res.json() method, and it works correctly for a given part of the data. Meaning that, if the data gets any bigger, express just doesn't send it, and the client throws a Network error, empty response as an error.
    I'm wondering if there's any limit in res.json(). But I can't find anything about this
    Md. Akhtar Uzzaman

    hi, i faced a problem while hosting nodejs application in cPanel.
    please suggest a solution

    Error ID:
    Web application could not be started by the Phusion Passenger application server.

    Please read the Passenger log file (search for the Error ID) to find the details of the error.

    You can also get a detailed report to appear directly on this page, but for security reasons it is only provided if Phusion Passenger is run with environment set to development and/or with the friendly error pages option set to on.

    Can you host a tcp webserver on express?
    basically have a 'master' router, called IndexRouter, which has some lower lever routers through router.use(). This is a system I use everywhere, but this time, it has some weird weird responses. Basically, I use IndexRouter -> UserRouter -> IdRouter
    UserRouter.use('/:id(\\d+)/', idRouter) is what I'm using right now for this specific thing, but, everything under that isn't working at all...
    For example I have a get endpoint for /users/:id/, and if I make the endpoint through UserRouter.get('/:id(\\d+)/', (req, res) => {}), it works, everything is executed etc, BUT if I use IdRouter.get('/', (req, res) => {}), its a 404?!
    if i used express-list-endpoints module, I get:
    /users/ RegExp(/^\\/(?:(\\id+))\\/?(?=\\/|$)/i)
    which isnt usually the case:
    any clues and what might this possible be?
    I installed express generator globally on PC. When trying to generate the app with express --view=ejs myapp , I get the error: bash: express: command not found I have tried to google search for a solution, but haven't had any success. Any ideas?
    Claude Martin
    What could be the reason that String.prototype.toString gives me \uXXXX instead of the unicode characters in the string representation of a function? I tested this using node with no imports and it doesn't do that. It only happens in express. I'm not sure if express is to blame (could be any other module) but I wouldn't know what else could cause this. I'm using angular and when running it in a browser I don't have this problem. But when using a server to validate the data it does that. And it's not a display problem or something that happens later on when sending the data back to the client. The returned string contains "\u00e4" instead of "ä". I checked the specs for ES and it shouldn't do that.
    Claude Martin
    I now see that this is done during compilation.
    Hello, I'm working on a project, and I'm trying to process a bunch of files and return them in a zip file. I'm using archiver and I'm hosting on aws. However, AWS idles out before the zip file is finished creating. I was wondering whether there was a way to begin sending the zip file as its being generated?
    Its sent in response by using a stream from archiver to the response object
    Mayank Aggarwal

    Hello everyone,
    This is Mayank Aggarwal, and I'm a pre-final year student at Manipal University Jaipur pursuing BTech in Information Technology.

    Portfolio - https://mayank0255.github.io
    GitHub - https://github.com/Mayank0255
    Linkedin - https://www.linkedin.com/in/mayank-aggarwal-14301b168/

    Maxim Yudayev
    @Mayank0255 Amazing portgolio website design! Love it!
    @Mayank0255 amazing work,keep it up
    @Mayank0255 :clap:
    Ryan Truran
    I'm building an application with express and react, what is the recommended process for keeping the user logged in for a period of time? cookies? jwt? sessions?
    James Pickard
    Does anyone know what's going on with Express 5.0? The main feature I'm after is better support for errors thrown by async request handlers (I know this can be achieved using express-async-handler but it would be nice to have first party support.
    @RyanTruran hi Ryan, I am using JWT with a time sensitive token. User is signed out after 20 min of inactivity. Whenever a user makes an API request , token is checked to ensure its valid. Result is returned only if its valid... What have you discovered so far?
    Ryan Truran
    @ghost~60648b666da037398478c87e I haven't spent too much time on the different methods.
    I am currently having an issue with my cookie not being set in the browser.
    I'm using express-session and the cookie security is set to false in the middleware. The session is being created and stored in my memorystore, but the cookie never appears.
    Ryan Truran
    Can someone help me with a cors issue i am having? I need to return a cookie to react client, which is making a post request the backend using axios. Initially everything was fine with cors because i was using “*” as the origin.
    however after realizing i needed to pass withCredentials into the axios request, cors no longer accepted the “*” origin.
    Im currently using localhost but may separate the servers before i deploy.
    Nicholas Pedroso
    Good night. Does anyone know how to disable eTag header for sendFile() method? app.set('etag', false) does not work on it
    If my understanding is correct, the app.set('etag', false) would have to be set before the request comes in for it to be set on that req/res pair.
    I am unsure if res.set('etag', false).sendFile()is still valid