GraphQL

Just wondering if anyone has looked at implementing GraphQL in Lucee (and or ColdFusion).

I came across these repositories for Java:

The servlet above has OSGI support. I know nothing about implementing/creating extensions with Lucee so am interested if anyone here could take a look and see if it should be feasible. I’d love to help contribute if it was indeed possible.

I reckon GraphQL support would be a big leg up for Lucee if it was supported.

Hi Bill,

I have been looking into it , don’t worry about the servlet but the java version. (servlet is just for mappings). I don’t think it needs to be an extension per se (I might be wrong there) since there are a number of domain specific actions you have to do. I did a few presentations on calling GraphQL from lucee but I have my side project on creating an implementation based on the java version.

MD

Hi Mark,

Are your presentations available somewhere and/or your side project?

I dont think I have made them public as they have a bunch of videos so it becomes a pain. The code is not even ready as it was just a way to think about how GraphQL could work in CFML (rather than an actuality)

I shall have another look at it and see if I can get a first pass out there, but if you want to know how to do it in java you can see here:

My example code is this:

query = URL.query;
result = new GraphQL()
				.setSchema("/myschema.graphqls")
				.resolvers({
					"Query", new Query(),
					"Mutation", new Mutator(),
					});
				.build()
				.execute(query);
writeDump(result);

I just uploaded a version of my presentation to SlideShare:

@markdrew Did you get some time on your side project? Will it be open source? If so, can I get private beta access :wink:

Alas not recently. Has been a while since I touched it since I have been doing some cfconfig additions instead (as side projects)

Would be great to get https://www.graphql-java.com/ or alike implemented as a lucee extension… anyone done any further work on this yet?

Eric Peterson was working on a proof of concept for GraphQL when we were at CFSummit, but he’s not in Discourse so I can’t tag him. He is, however, sitting next to me at this CFCamp session, so I’ll just bug him directly.

1 Like

Here’s a proof of concept using the java libraries you mentioned. You don’t need a Lucee Extension to use it.

2 Likes

This is pretty interesting. looks like you got it wired up nicely. Is there a way for this to work without so much dependency on coldbox?

Sure. The handlers/StarWars.cfc doesn’t have any dependencies on ColdBox. It’s using ColdBox to run the app because I find that the easiest way to do things. The handlers/StarWarsTwo.cfc was my attempt at simplifying the Java setup using ColdBox and WireBox.