martyjs / marty-express

express middleware for building isomorphic applications with Marty & react-router
http://martyjs.org
MIT License
11 stars 12 forks source link

Support for Koa? #5

Open bishtawi opened 9 years ago

bishtawi commented 9 years ago

Hi, Any plans to support the koa web framework?

jhollingworth commented 9 years ago

No plans right now to specifically implement Koa however I'm planning on abstracting the the internals so it's easy to add support for other web frameworks (e.g. Hapi)

Out of interest, beyond generators are there many differences with express?

bishtawi commented 9 years ago

The biggest change was to replace callbacks with generators. They also combined the res and req objects into a single context (the this object) and moved a lot of things to middleware. There are others, but thats really the big obvious differences. I modified your source to make it work with Koa. All I did was turn it into a generator, replace res and req with the koa contex, replace the res.render function with React.renderToStaticMarkup and added support for document title and 404 error. It works well enough for me to continue with my project.

tychotatitscheff commented 9 years ago

I would add a big +1. I can open a repo.

@bishtawi would you like to share some code. I was about to work on it but if you already done this start it would be nice.

bishtawi commented 9 years ago

Yeah, thats a good idea. I'll throw up the code I have up onto a repo later tonight. I didnt bother fixing the tests yet.

bishtawi commented 9 years ago

Alright, marty-koa is available here. Let me know if you have any problems.

tychotatitscheff commented 9 years ago

Wow. Nice work indeed. I would test it soon and open up issues if I have any problems.