Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    James Pickard

    @nfantone did you get a resolution for your comment here https://github.com/expressjs/express/pull/4321#issuecomment-1003836216 ?

    I'm confused. Once pillarjs/router#102 is merged, a new (beta?) version of router would need to be cut and express would need to be updated again.

    Also changes in 1574925 were already part of #4752, which was put on hold and marked as "Draft" until the above takes place, but I see no mention of this.

    2 replies
    Tim Chen
    hi, I'd like to find a google/facebook login implementation for expressjs, I found that Google and facebook has its own implementation, but also there is another lib call passportjs,
    Should I use passportjs or use google/fb own implementation?
    James Pickard
    Hi @momofarm - I don't have any experience on this but my understanding is that passportjs is fairly popular, so you should find good support for it. It's probably easier than integrating with the Google and Facebook implementations separately?
    Tim Chen
    I'm thinking about using auth0, since I am a one man dev and don't have much budget on user management........
    morning folks, is there a way to create an object in expressJS Middleware then access it down in a controller/route?
    James Pickard
    @gnubyte you can attach it to the request object in a middleware
    you can set arbitrary values on the request object which are then accessible to later routes and middleware
    A pattern I sometimes use is to attach a log object with info, debug, etc functions to the request object, that logs whatever you give it prefixed with a request ID
    Jim H
    don't have any experience in any sort of online/web development. I came up with an idea that I personally think is great in regard to the target audience it serves. I don't know if I should vividly share it on here but I would like to discuss the possibility of this online tool or service. I am looking to discuss this with someone familiar with the pharmaceutical world.
    can someone help or point me in the correct direction?
    James Pickard
    @luckyl2000:matrix.org it's always a tricky one when you have a good idea, of course you're not sure how much to share. Are you looking to discuss the technical feasibility of it with someone? I could possibly help you with that if you like

    Hi I am working on an Express App with TypeScript
    I am trying to configure CSRF Tokens with the CSURF Library. I followed the documentation accordingly and I when I ran my app, there was no problem. However, upon trying to make a POST request, I get a 403 error saying ForbiddenError : invalid csrf token

    The following is the code in my main express app called app.ts

    import express, { request, Request, Response } from 'express'
    import 'dotenv/config'
    import passport from 'passport';
    import session from 'express-session';
    import clientController from './client/client';
    import cors from 'cors';
    import csurf from 'csurf';
    import cookieParser from 'cookie-parser';
    import bodyParser from 'body-parser';
    const app = express();
    app.use(bodyParser.urlencoded({ extended: true }))
        credentials: true,
        origin: ['http://localhost:3000']
    const csrfMiddleware = csurf({ cookie: true })
    const port = process.env.PORT
    const sessionSecret = process.env.SESSION_SECRET
        secret: sessionSecret!.toString(),
        resave: true,
        saveUninitialized: false,
        cookie: {
            httpOnly: true
    passport.serializeUser((user: Object, done) => {
        done(null, user)
    passport.deserializeUser((user: Object, done) => {
        done(null, user);
    //Authentication route
    const authRoute = authController
    app.use('/auth', authRoute);

    I hope someone can assist me with this because I've spent a day or so trying to troubleshoot as to why I can't get csrf working

    Justice Lu
    The problem originated from the client side... how are you sending a request? You need to send the CSRF token with the request, probably including it with SSR (ejs or such).
    2 replies
    Hello, question 0 for me about express.js: is there a simple way to map all the methods and fields of an objects to a route, with parameters where appropriate?
    1 reply
    I am thinking of writing something myself
    James Pickard
    @vincenzoml sure it's possible
    James Pickard
    @StephenLynx I can't speak for the Express team or on the matter you're discussing, but I can tell you that there's only a very small number of people working on Express at the moment, and most likely the website simply hasn't been updated for a long time
    Momoh Tyler
    is Express Open source?
    James Pickard
    Momoh Tyler
    ok, thank you.
    Ali Ahsan
    hello everyone , i am using oauth2.0 in my app and i want to allow only people with university account (want to allow only specific domain) to visit my app. Anyone knows how to do it ?
    Ronique Ricketts
    You may have to create a list of domains then use cors to whitelist those domains
    Dina Berry
    Naming conventions question: if I have an Express.js app using views and I want to separate out View routes from Apis routes, what is the naming convention for these two routes? I'm used to Apis having /api/ in the route, but is there a corresponding route for views?
    James Pickard
    @dougwilson announced Express 5.0 beta.1 yesterday! 6 years in the making...
    Vineet Dixit
    I'm wondering why does Express call router.param after router.use here?
    outer.param("logNumber", (req, res, next, value) => {
      console.log("1 Called at", Date.now());
    router.use((req, res, next) => {
      console.log("2 Called at", Date.now());
    Console output
    2 Called at 1645747636698
    1 Called at 1645747636707
    hi all
    i'm having trouble working out how to access query parameters in a POST endpoint
    no matter what I try, it yields an empty object
    James Pickard
    @dan-cotruta did you figure it out? What are you trying?
    Matthieu Napoli

    Hey @euoia & @dougwilson, I see that activity is picking up again on GitHub 🎉
    I'm a maintainer of Serverless Framework (https://github.com/serverless/serverless). We have more than 8,000 users/month deploying Express to AWS.
    We want to build first-class integration between Express and AWS, and make it extremely easy for Express users.

    We have some ideas we want to share with you, would you be interested to discuss it? Should we contact anyone else?

    Kal Sze
    I'm confused. Is the error handling middleware supposed to go before my routes or after my routes? The documentation isn't clear about this: https://expressjs.com/en/guide/error-handling.html
    Matt Voboril
    @ksze for errors thrown in code, the handler should be before routes. for a catch-all route to give a generic error, you'd want that after all the other routes.
    1 reply
    Douglas Wilson
    Hi @mnapoli yes, I would be certainly interested! You're welcome to share where ever you like, the issue tracker, here, or DM me directly if you want. Happy to hear the ideas around that and what changes could be made.
    1 reply
    Shreyash Pingle
    Hey I just joined this. This is for express framework right
    Hi all! I'm having some difficulty with default engine not being specified. I'm using React, so I'm using sendFile to send to a static bin file (some middleware). Do I still need to specify a default engine in my app.js file?
    Biswajit Sharma
    Hi guys, I am stuck in a place where I am performing http GET request when a button is clicked, as a response I am getting a html page as a response. I am not able to redirect to that html page. For example I am in home page i.e localhost:4000 and performed a GET request localhost:4000/login, here i am getting the login html page from the server but not able to redirect it.
    hi, app.set('etag', false) will set all the response status to 200, how to limit this to only a particular router, say routes/users.js
    How do I convert a torrent into a readable stream? I'm using NodeJS, Express (for a web server), and Browserify (for WebTorrent), but since WebTorrent only works for WebRTC I can't use WebTorrent.
    Seif Eddine Slimene
    @Eltik You can use Browserify
    Md. Touhidur Rahman
    This message was deleted
    This message was deleted
    I have a problem!!!
    Why this custom Payload too Large limitter not working?
    Can anybody say?
    // Limit, 3 MegaBytes
    // 1 << 10 = 1024 << 10 = 1024 * 1024
    const limit = 3 << 20;
    // Text Body Parser
    server.use(function (req, res, next) {
      let ln = req.get('content-length');
      if (ln && ln > limit) {
      req.body = '';
      let overLimit = false;
      req.on('data', chunk => {
        if (overLimit) return;
        req.body += chunk;
        if (req.body.length > limit) {
          overLimit = true;
      req.on('end', () => {
        if (!overLimit) next();
    Even if payload exceeds the limit, the request is still processed.