lukeed / polka

A micro web server so fast, it'll make you dance! :dancers:
MIT License
5.39k stars 172 forks source link

next function in single function case #77

Open fanatid opened 5 years ago

fanatid commented 5 years ago

I'm not sure, was such issue raised before or not, I tried search, but did not found.

Why next function is not provided if route have only 1 function? https://github.com/lukeed/polka/blob/e7aa451fe311dae1915d043ee95a2dd1a75343ff/packages/polka/index.js#L92 Is not right code will be:

if (len === i && num === 1) return fns[0](req, res, err => err && this.onError(err, req, res, next));
lukeed commented 5 years ago

Hey, sure, this was intentional (initially). Every endpoint should include its own termination.

That said, this has already been fixed in the next version of Polka (not yet released) because I realized the inconsistency here. I'll leave this open for tracking purposes while I get 1.0 together.

Thanks!

fanatid commented 5 years ago

Thanks for quick reply, any ETA when 1.0 will be released? Also, can you point where I can find code of 1.0?

lukeed commented 5 years ago

No problem~ 1.0 will be released early January. I'll be polishing it up over the holidays. The code is not public yet as it exists/has been developed within personal projects

leeoniya commented 5 years ago

@lukeed any updates on 1.0?

lukeed commented 5 years ago

The core for 1.0 is complete. I'm now just working on supporting packages / middleware. The biggest of them, for illustration, is attaching view engine(s) to your application on command. Express has it built-in, so this will be one of the few remaining differences.

I hope to do a very short next release cycle once all these decisions have been made. Since things are changing a lot on an organizational level (package re-arrangement, names, etc) I haven't been keen on publishing new versions/tags since it'd just add confusion.