Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    can someone help me to understand, where does object req.user come from ?
    Seif Eddine Slimene
    @rashid-naico_gitlab Use debugger statement and see the call stack.
    David Anderson

    I'm (trying to) use a vhost to serve static assets from a subdomain of my api, i.e.:
    api: demo.local.io
    static assets: assets.demo.local.io

    Just as a test case, I've set up a vhost something like the following:

    const assets = express();
    assets.get('*', (req, res) => {
      console.log('route reached');
      res.send('<html><body>Hello world</body></html>');
    app.use(vhost('assets.demo.local.io', assets));
    It seems that my route is successfully being reached—my server logs the above statement—but the response is never sent, and a route that is defined subsequently on the app express instance is reached instead.
    Any ideas what might be going wrong? I would have guessed that the later route should never be reached once the res.send() is called, but that seems not to be the case
    David Anderson
    The route that is being hit is my authentication route
    How can I get the raw body from the request?
    Simon Bailey
    Hey all, is it possible to access req.query on POST routes? Seems to be working fine for GET but undefined for POST
    how would i get the ip of an express server?
    the server is set up like this:
    const app = express();
    const server = app.listen(port);
    I can't get TS to be happy with wraping res.write at all
    This channel doesn’t seem very active. Is irc used more?
    MERN Micro Framework

    Hello Everyone, MERN Stack Boilerplate provides starter kits for building web, desktop and mobile apps in pure JavaScript.


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

    I have updated my PR with a long standing issue and the test case is working.
    Claudio Teixeira
    Hello guys.
    Can you please let me know if the following endpoints are REST compliant?
    ok so my api randomly stopped working
    im using tyoescript and it gives me errors now
    Screen Shot 2021-10-09 at 2.02.43 PM.png
    I fixed it
    I created a folder called source in my project and moves tsconfig into that
    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