Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    James Pickard
    @euoia
    @nfantone @dougwilson are you aware of anything else I could help with?
    Nicolás Fantone
    @nfantone
    Nicolás Fantone
    @nfantone
    @euoia also reviewed expressjs/expressjs.com#1315
    James Pickard
    @euoia
    @iron2414mw did you figure it out?
    Norbert Varjasi
    @iron2414mw
    @euoia I did, took me sometime tho. The trick was to remove objects from the router stack, filtering them by path. Then it's gone, and I can even declare it again, if I want
    James Pickard
    @euoia
    ah right, interesting
    @crandmck are you still involved in Express documentation at all? We could use your help reviewing some documentation changes please
    James Pickard
    @euoia
    @dougwilson @nfantone the next milestone we're working towards, is that releasing Express v5 as a beta or releasing it as the main stable version (i.e. npm install express gives you v5)?
    2 replies
    James Pickard
    @euoia

    @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
    @momofarm
    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
    @euoia
    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
    @momofarm
    I'm thinking about using auth0, since I am a one man dev and don't have much budget on user management........
    gnubyte
    @gnubyte
    morning folks, is there a way to create an object in expressJS Middleware then access it down in a controller/route?
    James Pickard
    @euoia
    @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
    @luckyl2000:matrix.org
    [m]
    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
    @euoia
    @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
    efhan-the-unorthodox
    @efhan-the-unorthodox

    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(cookieParser())
    app.use(bodyParser.urlencoded({ extended: true }))
    app.use(express.json())
    app.use(cors({
        credentials: true,
        origin: ['http://localhost:3000']
    }));
    
    const csrfMiddleware = csurf({ cookie: true })
    
    const port = process.env.PORT
    const sessionSecret = process.env.SESSION_SECRET
    
    app.use(session({
        secret: sessionSecret!.toString(),
        resave: true,
        saveUninitialized: false,
        cookie: {
            httpOnly: true
        }
    }))
    app.use(csrfMiddleware)
    
    app.use(passport.initialize());
    app.use(passport.session());
    
    passport.serializeUser((user: Object, done) => {
        console.log(user)
        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
    @codingjlu
    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
    vincenzoml
    @vincenzoml
    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
    @euoia
    @vincenzoml sure it's possible
    James Pickard
    @euoia
    @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
    @tylerjusfly
    is Express Open source?
    James Pickard
    @euoia
    Yep
    Momoh Tyler
    @tylerjusfly
    ok, thank you.
    Ali Ahsan
    @ALIAHSANRST
    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
    @RoniqueRicketts
    You may have to create a list of domains then use cors to whitelist those domains
    Dina Berry
    @diberry
    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
    @euoia
    @dougwilson announced Express 5.0 beta.1 yesterday! 6 years in the making...
    Vineet Dixit
    @vineetdigit
    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());
      next();
    });
    
    router.use((req, res, next) => {
      console.log("2 Called at", Date.now());
      next();
    });
    Console output
    2 Called at 1645747636698
    1 Called at 1645747636707
    dan-cotruta
    @dan-cotruta
    hi all
    dan-cotruta
    @dan-cotruta
    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
    @euoia
    @dan-cotruta did you figure it out? What are you trying?
    Matthieu Napoli
    @mnapoli

    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
    @ksze
    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
    @TobiTenno
    @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
    @dougwilson
    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
    @shrey802
    Hey I just joined this. This is for express framework right
    MattChale123
    @MattChale123
    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
    @biswajitatgithub
    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.
    sqllyw
    @sqllyw
    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
    Eltik
    @Eltik
    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
    @SeifESlimene
    @Eltik You can use Browserify
    Md. Touhidur Rahman
    @touhidurrr
    This message was deleted