Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    it fixed the errors
    Kal Sze
    Does Express have the ability to have a global, catch-all, exception handler that will just log the exception with traceback? Right now, my whole server crashes if an exception is raised in any of the route handlers and is not caught explicitly.
    Hey everyone. I'm pretty new to express, and I'm extremely baffled at why I every route except for the index route comes back as a 404. I had others but I removed them. I can't find any errors, and postman shows it's a normal 404 for any get, post, etc method. Anyone have any ideas? https://github.com/bcaylor10/scattergories-rooms-server/blob/master/routes/rooms.js
    Arthur Gritsishin
    Hello everybody! Sorry for my english, I am using a translator.
    Friends, I'm just learning, help me figure out the problem.
    There is a task to translate the text in some paragraphs of the PUG template.
    I am trying to pass to res.render (layout, {"year_of_birth_for_translate": "year of birth",} where year_of_birth_for_translate is the ID of the P item in the PUG template.
    As a result, nothing changes in the layout, it does not give errors either. Please help me figure out what I'm doing wrong? Thank you all for your help!
    Lorenzo Sandini
    Hello everyone, beginner question for starters. I am trying to write an api in order to use the astronomy-bundle package. So far, so good. I wrote a small node/express app serving static a static HTML file.
    My HTML file has a form posting a date to app.post route on my API, where the date is saved as a date.json file server-side. Then the node app should pick up the new date, pass it to the astronomy script computing planet coordinates, and save the new coordinates as a data.json file.
    I need the client to reload the HTML file to display the new coordinates next to the date, in the entry form.
    Lorenzo Sandini
    It works fine the first time after loading the app.js on my server, and when the client posts a new date, the date.json is written correctly and the coordinates written correctly also. But even when reloading the page on the client, the coordinates aren't updated. I need to reload the server app in order to see the updated corrdinates in my HTML page. Hot reloading the server doesn't sound like the right thinkg to do... Suggestions ?
    Hello, I'm trying to send a simple signal to a specific path for a heartbeat API, but I am new to express and don't really know how to use it.
    Every minute the "pulsing heartbeat" log will be sent, but the pulse itself will not.
    I also tried res.send(); but it didn't work.
    is it normal for a middleware you made to be called multiple times for one request?
    Instead of putting some request specific things into the request object, is it a good practice to store and access with the help of cls-hooked?
    It is a bit tedious to pass down eg. the logger to every little method.
    MERN Micro Framework

    Hello Everyone,

    MERN Micro Framework provides starter kits for building web, desktop and mobile apps in pure JavaScript.


    If you have any query or suggestions. Please let me know.

    Hello I am learning web dev and I am creating a very simple app using express and handlebars. I am having troubles to serve static files when I use routers
    my code looks like this:
    app.use(express.static(path.join(__dirname, 'static')))
    after which I connect the router
    app.use('/users', usersRouter)
    If i serve files from my main file index.js I get all the static content. However, if i open any page under the '/users/' path I get no static content. Moreover, if I open the browser console I get this error message
    The resource from “http://localhost:3000/users/css/style.css” was blocked due to MIME type (“text/html”) mismatch (X-Content-Type-Options: nosniff).
    why is the '/users' being added to my link and why is this happening?
    Jamund Ferguson
    @eitanbronschtein how are you referencing your CSS in your HTML? It may need to be /css/style.css instead of css/style.css. Without the initial / it will be relative to the current path /users in that case
    Hello, how can I get just raw request body without any parsing?
    seems using express.raw() as body parser middleware works
    Hello, Im curious to know when we increase the parsing limit for a request body to avoid payload issue (100kb default to 10mb) will it impact on performance if so how much?
    Tom Cruickshank
    Hello, I'm interested in using a MVC for express for building a REST API. Would anyone recommend a good documentation to learn more how to do it?
    James Pickard
    Hey all, has anyone looked at spinning each request off into it's own VM so you can use console.log anywhere in your app and have it prefixed with a unique request identifier?
    Or is that a crazy idea?
    Jacob B. Sanders

    @tomvisions, you can find quite a few examples on the official docs example page: https://expressjs.com/en/starter/examples.html

    Additionally, mozilla has a fairly extensive tutorial on views and mvc-related contexts here: https://developer.mozilla.org/en-US/docs/Learn/Server-side/Express_Nodejs/routes

    James Pickard
    I recall reading an issue where @dougwilson said he was really trying to get Express 5.0 released before the end of the year... does anyone know how that's going?
    I am asking in case there's anything I can help with
    James Pickard
    Happy new year everyone!
    James Pickard
    I would like to do a write up on the status of Express, a bit of history, and the challenges with releasing 5.0 - would anyone be interested in reading that?
    James Pickard
    I am curious, is there some other chat room for Express, because for a library 12.5 million downloads per week, this room doesn't seem very active
    James Pickard
    I will work on a pull request for this issue expressjs/expressjs.com#1313
    Nicolás Fantone
    for all of you wondering about the state of the project and when/if 5.0 is landing: at this point in time, sadly, there seems to be more people willing to help than actual progress being put forward Express 5.0
    to my knowledge, there's only one outstanding (major) issue that needs to be addressed before moving out of alpha: pillarjs/router#102
    I have worked on it and, IMHO, it should be ready for merging - unfortunately, effort seems to have died out due to lack of communication/time from maintainers
    Nicolás Fantone
    if anyone wants to contribute and give a hand, a very simple way would be to show support and participate on that issue
    Douglas Wilson
    Hi @euoia I ended up going to the emergency room right befire Christmas and so was unable to get the 5.0 beta released, but I did get a 4.x patch. I have received 4 security vulnerability reports in the interim and will need to triage / address / make some additional 4.x releases as soon as I am discharged before I can resume 5.x work. I hope that answers your question. Let me know if you would like any further information and happy new year everyone. Sorry for the set back and I think we can get 5.0 released before the end of January, as there is almost nothing left there. I pushed some more commits to the 5.0 branch but just didn't get to cut a new release off it yet.
    Nicolás Fantone
    hey @dougwilson, many thanks for the update and very sorry to hear about your personal situation; hope you're feeling much better now! With regards to the vulns: would there be someone else that could be taking a look at those in the meantime? I'm up for it, if you need a hand.
    James Pickard
    Hi @dougwilson, I really appreciate the update. When I was looking through the GitHub issues again I saw your comment about recovering from sickness, and I'm sorry to hear you've been unwell again. I am going to see if I can get a pull request together for expressjs/expressjs.com#1313 and would also be happy to look at security issues if it's of any help. I will read through pillarjs/router#102 and see if there's anything I can contribute there.
    James Pickard
    I've read through the pillarjs/router#102 issue - should I have a stab at updating the migration guide to mention these changes? https://github.com/expressjs/expressjs.com/blob/gh-pages/en/guide/migrating-5.md
    Nicolás Fantone
    I think that'd be nice
    James Pickard
    Ok, will do
    I'm just looking at the description of callback functions here