Giter Site home page Giter Site logo

Comments (4)

thekevinbrown avatar thekevinbrown commented on August 14, 2024 1

I ended up not using express-promise-router for now.

from overnight.

maulerjan avatar maulerjan commented on August 14, 2024

Same problem here. Any solution?

from overnight.

orendaeko avatar orendaeko commented on August 14, 2024

for me use express-promise-router can't get req.body but if use normal router at sample project its working fine,
thanks for sharing

from overnight.

Papooch avatar Papooch commented on August 14, 2024

Had the same problem, but I think I solved it!

It seems that when using express-promise-router, you have to pass a string to the @get() (or any) decorator.

e.g. this returns 404 for GET /docs

@Get()
async getArray(req: Request, res: Response) {
    const docs = await this.docsService.getArray();
    res.json(docs.map(this.docMapper.toDto));
}

But when you pass an empty string to the decorator, it works!

@Get('') // pass '' if the route takes no params
async getArray(req: Request, res: Response) {
    const docs = await this.docsService.getArray();
    res.json(docs.map(this.docMapper.toDto));
}

I don't know where the issue lies exactly, but this seems to have solved it for me.

from overnight.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.