Giter VIP home page Giter VIP logo

Comments (12)

talentlessguy avatar talentlessguy commented on May 20, 2024 1

@creepinson, OK reoping

I won't be able to help ya for ~2 weeks so pls be patient :)

from tinyhttp.

talentlessguy avatar talentlessguy commented on May 20, 2024 1

Ok, I'm back here

the issue comes from when there are more than 1 wares passed to app.method

will look into this very soon

from tinyhttp.

talentlessguy avatar talentlessguy commented on May 20, 2024

@creepinson once again I will need a reproducible demo :)

from tinyhttp.

theoparis avatar theoparis commented on May 20, 2024

Oof, I installed the latest version of @tinyhttp/app and got this on almost every page except for /profile....
image

/ should at least be found here but its not anymore
heres the code: https://hastebin.com/jaxefuqapo.coffeescript

from tinyhttp.

talentlessguy avatar talentlessguy commented on May 20, 2024

@creepinson interesting, there is some external module made by you. Could you please make a route-only demo that I can try?

Also, body-parser doesn't work. See #25

from tinyhttp.

talentlessguy avatar talentlessguy commented on May 20, 2024

@creepinson is it still relevant?

from tinyhttp.

talentlessguy avatar talentlessguy commented on May 20, 2024

I'm not sure if it is still relevant, so closing

feel free to re-open if it persists

from tinyhttp.

theoparis avatar theoparis commented on May 20, 2024

Ok, well I'm still getting a 404 error and it seems to be with using multiple middlewares like so:

My "test" middleware:

async function test(req: Request, res: Response, next?: NextFunction) {
	console.log(`req body: ${JSON.stringify(req.body)}`);
	next!();
}

Then I use it like so:

app.post('/register', test, register);

where the test middleware is supposed to be executed and then after it is called my register middleware in the rest of my code gets called. While it does execute the test middleware and prints out the request body, it then gives the following from the logger middleware:
POST 404 Not Found /register
even though it just worked with the first test middleware.

I will try and make a reproducable demo as well.

from tinyhttp.

theoparis avatar theoparis commented on May 20, 2024

Ok, I've managed to create a simple demo: https://github.com/creepinson/tinyhttp-example/blob/master/src/index.ts

Incorrrect output from the demo:

Listening on :8080
Req url: "/test"
GET 404 Not Found /test

which gives my 404 response back to the curl command.

What should be logged:

Listening on :8080
Req url: "/test"
GET 200 OK /test

and the response should be a json object that was specified in the code.

from tinyhttp.

theoparis avatar theoparis commented on May 20, 2024

I don't think I can reopen this issue manually, I think you have to do it for me because you are the one that closed the issue.

from tinyhttp.

talentlessguy avatar talentlessguy commented on May 20, 2024

@creepinson should be fixed now, in this code:

https://github.com/talentlessguy/tinyhttp/blob/53043780f23a716b2664a71c6b367b2dd0e941ec/packages/app/src/router.ts#L91-L98

please check

from tinyhttp.

theoparis avatar theoparis commented on May 20, 2024

seems to be working with my small example :D
I will also try my larger example but I think it might be fixed.

from tinyhttp.

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.