Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    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.
    Hello everyone, what db would you use if you had entries that you wanna lookup via location, like when you give your location info to the server and get back the locations sorted by closest to you, and does it make sense to keep the entries in express memory then to retrieve it with every call. because the entries will not change often?
    1 reply
    Robyn Drake
    I try and start the express server side of this basic web application and I get this error: TypeError: Router.use() requires a middleware function but got a string codes is at https://github.com/robindrake/starter-express-api the answers I'm finding, I've already done what was said.
    The "/" route works just fine
    I need to leave to wait for transport to dialysis in 15 minutes.
    Robyn Drake
    Oh well.
    Robyn Drake
    Lucas Marra
    Hello hello... anyone here using 'mongoose-unique-validator' uniqueValidator?
    Need help with error message...
    7 replies
    Kyle Anthony Williams
    I have a very silly question. Is it possible to embed a Node HTTP server within an Express app? :)
    you can tell express to use a static website with index.html or javascript, for example you could host an angular app within, i did not try it but why shouldn´t a node http server not work when set as static site
    Hagen DeRouen
    How do I service static files in my public directory that's not at the root. My directory is structured as follows:
    Vaibhav Arora
    app.use(express.static(path.join(__dirname, 'src', 'public'))); might work
    Hi, I'm new to ExpressJS and self-taught developer. I'm trying to browse about the difference between session https://www.npmjs.com/package/express-session vs session storage, but I don't find it yet. Anyone here wants to give me a bit about keywords or blog posts regarding that? Thank you! :)
    Ahoy! How usable is the 5.0 beta for a production app?
    I guess I can answer my own question: "it depends". I use TypeScript, and since Express doesn't maintain its own type definitions, the answer is "presently unusable". Since Express is written with JSDoc support, would the community consider auto-generating types from them? https://www.typescriptlang.org/docs/handbook/declaration-files/dts-from-js.html
    @simsalabimabri_twitter maybe you can find useful info on MDN?
    Csaba Horváth
    I am developing a nodejs express project and earlier when I was developing on Mac and Windows this worked for serving js files from public/js folder: app.use(express.static(__dirname + '/public')); Now I stardted to develop on Ubuntu and only public/js folder not served by the server. Other folders is ok for example images, css etc... What can be the proble and why is it works on other systems? I am developing and debugging the project using VS Code.
    Ryan Truran
    What is the error message
    Ryan Truran
    Also, You should be using path.join instead of string concatenation for paths.
    Csaba Horváth
    I tried that, but not works and I think not the js folder is problematic. I tried to rename files and resave files and some of them is ok now, but for example an external jquery.form.min.js.map file not getting ok. Maybe some file system problem is in the backgroud???
    Csaba Horváth
    I think the problem is that in the scripts src property url folder name is not starting with capital letter but the folder nam is capitalized. So the folder is 'Work' and the src is '/js/work/work.js'. If I change '/js/Work/work.js' it resolves that. Is this caused by different operating systems?
    Ryan Truran
    Yes some systems have a case sensitive file system.
    Omar Dulaimi

    Hey everyone,
    I would like to access the req route path(the regex) inside a middleware handler

    app.use((req, res, next) => { 

    But since req.route is undefined inside middleware handlers, I was looking for a workaround.

    The only one I found involved accessing the internal app router that is private, which is a bad idea of course:

    function getRoutePath(path) {
      var stack = app._router.stack;
      for (var i = 0; i < stack.length; i++) {
        if (stack[i].route && stack[i].match(path)) {
          return stack[i].route.path;

    So what do you suggest?

    Bijan Parsiyar
    hi guys does anybody want to pair program? I am a CS student currently in Uni.
    Ronique Ricketts
    @bijanparsiyarr what are you working on ?
    Andrew Reid

    Hi everyone,
    I'm currently pulling my hair out trying to resolve an install problem and I don't appear to find any help with these error codes online.
    I have tried uninstalling and reinstalling node and npm several times but still get the same error.
    I'm using Windows 11 Pro.

    PS C:\_offline\NodeJs_Tutorial\tutpoint> npm install express
    npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
    npm ERR! code EBUSY
    npm ERR! syscall rename
    npm ERR! path C:\Users\educa\AppData\Local\npm-cache\_cacache\tmp\a48e6415
    npm ERR! dest C:\Users\educa\AppData\Local\npm-cache\_cacache\content-v2\sha512\0f\98\3eb786fdcfde4d0e7d392c801d220122a66d5d7f5fe56b081f53e11555eb0b3d518a42e2184ac577fd7499afde46354392ab219538eb08966873d42bb6c9
    npm ERR! errno EBUSY
    npm ERR! Invalid response body while trying to fetch https://registry.npmjs.org/body-parser: EBUSY: resource busy or locked, rename 'C:\Users\educa\AppData\Local\npm-cache\_cacache\tmp\a48e6415' -> 'C:\Users\educa\AppData\Local\npm-cache\_cacache\content-v2\sha512\0f\98\3eb786fdcfde4d0e7d392c801d220122a66d5d7f5fe56b081f53e11555eb0b3d518a42e2184ac577fd7499afde46354392ab219538eb08966873d42bb6c9'
    npm ERR! A complete log of this run can be found in:
    npm ERR!     C:\Users\educa\AppData\Local\npm-cache\_logs\2022-06-07T04_00_20_150Z-debug-0.log

    Also followed all the instructions to clear the cache, etc. but with no luck.
    Does anyone have any ideas? Thanks.

    1 reply
    Hi, i have this error when i try to run nodemon to get on the server

    path = ('^' + path + (strict ? '' : path[path.length - 1] === '/' ? '?' : '/?'))

    TypeError: Cannot read property 'length' of undefined

    Bernard Kortor
    Hello guys. I have challenge getting a single record from postgresql using expressjs. I'm new in nodejs pls help me out. below is code for my router; //Select campaign by Id
    router.get("/:id", (req, res) =>{
    getCampaignById().then((campaign) =>{
    }).catch((error) =>{

    see my controller; const getCampaignById = async() =>{
    //console.log('get by id')
    const id = parseInt(req.params.id)

    const results = await pool.query(queries.getCampaignById, [id]);
     return results.rows



    Hi I was hoping to get some help with this issue.
    I'm trying to print the database items in a ul and have each be iterated through. I've tried several things but am at a stand still.

    This is the git rep that I'm working with. It's from a tutorial. I'm wondering if anyone can guide me in trying to access the mysql elements. Ideally I'm going to make an mvc and instead of getting ALL results I'd like to have them listed individually.



    James Gardner
    Has anybody had any luck generating openAPI docs from their express code?
    3 replies
    I'm trying to add authentication in my express.js web app. I wish to store email and password using sqlite. What is best to use? JWT or Passport? Someone can advice me please?