krakenjs / swaggerize-express

Design-driven apis with swagger 2.0 and express.
Other
354 stars 81 forks source link

Allow async handlers #138

Open juliusza opened 6 years ago

juliusza commented 6 years ago

Allows route handlers to be async functions

Based on https://medium.com/@Abazhenov/using-async-await-in-express-with-node-8-b8af872c0016

Or see README for more info

jsdevel commented 6 years ago

FYI, express-openapi supports this.

juliusza commented 6 years ago

Thanks, I will look into that lib.

juliusza commented 6 years ago

Is there a reason not to accept this PR though ? express-openapi does not work out of the box for me, I'd rather stick with swaggerize-express

jsdevel commented 6 years ago

express-openapi does not work out of the box for me

@juliusza what issue were you having? Can you open one? https://github.com/kogosoftwarellc/express-openapi/issues

juliusza commented 6 years ago

ok, how about this one? https://github.com/kogosoftwarellc/express-openapi/issues/91

tlivings commented 6 years ago

Will review. Kraken team has been under a lot of resource constraints and it’s been hard to turn around PRs. Apologies.

tlivings commented 6 years ago

Can you add some tests?

tlivings commented 6 years ago

Also, for what it’s worth at this point https://github.com/krakenjs/hapi-openapi is more actively maintained. Unless you have some overriding preference for express applications.

juliusza commented 6 years ago

I hope test is satisfactory. Please also bump major version to 5.0.0, because this now requires native Promise support and might not work for very old nodejs versions.

Tests now require node v8 to run. But node 4.8.7 is enough for lib to work correctly.

juliusza commented 6 years ago

Also do you think you could bump enjoi version ?

https://github.com/krakenjs/swaggerize-routes/issues/94