Skip to content

Instantly share code, notes, and snippets.

@leocavalcante
Forked from marcosborges/sile-swoole-graphql.php
Created April 22, 2020 00:55
Show Gist options
  • Save leocavalcante/0de99769fd6b1666d38d310c19df2ab2 to your computer and use it in GitHub Desktop.
Save leocavalcante/0de99769fd6b1666d38d310c19df2ab2 to your computer and use it in GitHub Desktop.
#!/usr/bin/env php
<?php declare(strict_types=1);
use Siler\Route;
use function Siler\Swoole\{graphql_handler, http};
require_once __DIR__ . '/bootstrap.php';
global $schema, $root_value, $context;
$handler = graphql_handler($schema, $root_value, $context);
$server = function () use ($handler): void {
Route\post('/graphql', $handler);
};
http($server, 9501)->start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment