Class: Twenty::Servlet::GraphQL
- Inherits:
-
Twenty::Servlet
- Object
- WEBrick::HTTPServlet::AbstractServlet
- Twenty::Servlet
- Twenty::Servlet::GraphQL
- Defined in:
- lib/twenty-backend/servlet/graphql.rb
Instance Method Summary collapse
-
#do_POST(req, res) ⇒ Object
POST /servlet/graphql/.
Methods included from ServerMixin
Instance Method Details
#do_POST(req, res) ⇒ Object
POST /servlet/graphql/
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/twenty-backend/servlet/graphql.rb', line 4 def do_POST(req, res) params = JSON.parse(req.body) result = Twenty::GraphQL::Schema.execute( params['query'], variables: params['variables'], context: {} ) res['content_type'] = 'application/json' res.status = 200 res.body = result.to_json end |