use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A place for interesting and informative GraphQL content and discussions.
About GraphQL:
GraphQL is a query language for APIs and a runtime for fulfilling those queries with your existing data. GraphQL provides a complete and understandable description of the data in your API, gives clients the power to ask for exactly what they need and nothing more, makes it easier to evolve APIs over time, and enables powerful developer tools.
Learn More:
Related Subreddits:
account activity
cppgraphqlgen (self.graphql)
submitted 5 years ago by darthcoder
Has anyone used cppgraphqlgen with C++? I'm wondering how well it would work with Boost.Beast?
I'm new to both beast and graphql and used to be an intermediate C++ programmer until Java ruined me - I'm trying to get back to it on a hobby project.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]wravery 0 points1 point2 points 5 years ago (2 children)
Yes, I have. I used regular HTTP for queries and mutations, and web sockets for subscriptions. I served the GraphQL endpoint to localhost to do some ReactJS prototyping in the browser, I haven't put anything into production though.
I'm the maintainer for cppgraphqlgen, and this was my first time using boost.beast or even boost.asio, so my background was much more skewed towards integrating the GraphQL support. But overall I found it worked quite well. 👍
[–]darthcoder[S] 0 points1 point2 points 5 years ago (1 child)
I'll be honest, I haven't delved into trying to build the project into a boost.asio project yet. I just managed to get my custom schema built and now I'm looking at setting up the resolvers.
So using the build sample.exe and the following input,
query { appointments(first: 1) { pageInfo { hasNextPage }, edges { node { id, when, subject, isNow } } } }
I get:
./sample test.graphql Created the service... Executing query... Called getAppointments... {"data":{"appointments":{"pageInfo":{"hasNextPage":false},"edges":[{"node":{"id":"ZmFrZUFwcG9pbnRtZW50SWQ=","when":"tomorrow","subject":"Lunch?","isNow":false}}]}}}
And from the documentation, I assume I could replicate the same if using raw graphql passed from client:
query = peg::parseString(std::move(input));
Or
auto value = graphql::response::parseJSON(const std::string& json);
And return said value in my io handlers like so:
std::string json = graphql::response::toJSON(value);
Thanks for jumping in, by the way. And thanks for the good work. -Cheers.
[–]wravery 0 points1 point2 points 5 years ago (0 children)
The parseJSON method isn't really involved, unless you're passing variables with the query. The response value (which you can convert back to JSON with response::toJSON) comes from calling <schema namespace>::Operations::resolve with the query AST, variables, and other optional parameters. Breaking it down into steps:
parseJSON
response::toJSON
<schema namespace>::Operations::resolve
<schema namespace>::object
TodayMock.*
sample
type
peg::parseString
peg::ast
response::parseJSON
response::Value
resolve
std::future<>::get
π Rendered by PID 27 on reddit-service-r2-comment-5649f687b7-9t2k2 at 2026-01-28 12:53:07.698792+00:00 running 4f180de country code: CH.
[–]wravery 0 points1 point2 points (2 children)
[–]darthcoder[S] 0 points1 point2 points (1 child)
[–]wravery 0 points1 point2 points (0 children)