feroult / yawp

Kotlin/Java API framework for Google Appengine
http://yawp.io
MIT License
131 stars 19 forks source link

Add JS runtime for user code #74

Open feroult opened 8 years ago

feroult commented 8 years ago

I'm planning to add a javascript runtime for user code on YAWP!

With that it will be possible to define endpoints, actions, hooks, pipes, etc, and deploy them automatically without recompiling everything and deploying YAWP! again.

Rhino seems to be outdated and Nashorn is only supported in Java 1.8, which means that we need to go to Appengine Flexible Environment. At first, this is not a real problem, I think that this is just a matter of time anyways.

For the JS part, I was thinking about TypeScript, because it can provide more meta information on classes and methods. Does anyone with experience in TS want to help or give some advise?

Regards

luanpotter commented 8 years ago

I believe the first step will be to alter EndpointFeatures (and RepositoyFeatures) class to support these changes. Because right now, it just hold references to the classes via Class<?> objects. Those are pretty much immutable as far as I know, or otherwise a pain to make changes to. So we should create proper classes to hold information about the models directly, and upon startup parse all the Class<?>es and fill our own data structure. Then it would be easy to add new fields or whatever. The only problem are the methods, for which references will still have to be kept, for the ones defined in Java, but new ones need to be able to be created with JS code.

Also, there will be a problem regarding changing the Java code after a change via JS, because the models will no longer reflect the reality. But I don't think that's a huge problem for now.