archival-IIIF / server

Archival IIIF server
https://archival-iiif.github.io
MIT License
9 stars 4 forks source link

Choice for Express #22

Closed kerim1 closed 6 years ago

kerim1 commented 6 years ago

I was wondering why you decided to go with Express as the web framework? I'm wondering if koa is not a better choice, as it's minimalistic design fits the project much better? It has a cleaner, more up-to-date API (like async-await support) and is much faster as it doesn't bring along the bulk of code and middleware we are not going to use anyway.

If you are ok with it, I could refactor the code to koa instead of express in a separate branch and then compare the result? It shouldn't be too hard, as much of the setup is still the same though.

Sozialarchiv commented 6 years ago

I experimented a litte bit with koa. Both frameworks seemed to be okay for me.

The only thing I noticed with koajs was the following:

https://github.com/koajs/koa/blob/master/docs/troubleshooting.md#my-response-or-context-changes-have-no-effect:

ctx.body is not set until after the response has been sent. The code doesn't tell Koa to wait for the database to return the record.

No problem, but a little bit mirgration work. But if you think it is worth feel free to migrate it.

kerim1 commented 6 years ago

As can be seen in the iish branch, Express had been replaced with koa. The thing about ctx.bodynot set is not understanding how async/await works. So, this has nothing to do with the framework itself.