{"id":15043138,"url":"https://github.com/annihil/ugql","last_synced_at":"2025-04-14T20:51:45.359Z","repository":{"id":57385098,"uuid":"185294273","full_name":"Annihil/ugql","owner":"Annihil","description":"🚀GraphQL.js over HTTP with uWebSockets.js","archived":false,"fork":false,"pushed_at":"2019-05-19T23:50:37.000Z","size":9,"stargazers_count":27,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-28T09:04:24.395Z","etag":null,"topics":["graphql","graphql-js","graphql-server","node","node-module","nodejs","npm-package","uwebsockets"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Annihil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-07T01:01:15.000Z","updated_at":"2022-06-01T23:18:03.000Z","dependencies_parsed_at":"2022-09-07T16:13:48.930Z","dependency_job_id":null,"html_url":"https://github.com/Annihil/ugql","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Annihil%2Fugql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Annihil%2Fugql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Annihil%2Fugql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Annihil%2Fugql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Annihil","download_url":"https://codeload.github.com/Annihil/ugql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248960951,"owners_count":21189990,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graphql","graphql-js","graphql-server","node","node-module","nodejs","npm-package","uwebsockets"],"created_at":"2024-09-24T20:48:37.215Z","updated_at":"2025-04-14T20:51:45.342Z","avatar_url":"https://github.com/Annihil.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# µGQL\n[![npm](https://img.shields.io/npm/v/ugql.svg?style=flat-square)](https://www.npmjs.com/package/ugql)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)\n[![package dependencies](https://img.shields.io/david/Annihil/ugql.svg?style=flat-square)](https://david-dm.org/Annihil/ugql)\n![](https://img.shields.io/badge/benchmark-150x%20express--graphql-blueviolet.svg?style=flat-square)  \nLeveraging [GraphQL-js](https://github.com/graphql/graphql-js) with [µWebSockets.js](https://github.com/uNetworking/uWebSockets.js)\n\n## Installation\n\n`npm i ugql` or `yarn add ugql`\n\n## Usage\n\nCreate an `app.mjs` file with the following content:\n\n```js\nimport uWS from 'uWebSockets.js';\nimport gql from 'graphql';\nimport ugql from 'ugql';\n\nconst { buildSchema } = gql;\nconst app = uWS.App();\nconst ugraphql = ugql(app, async (res, req) =\u003e ({})/* middleware */, true /* cors */);\n\nconst schema = buildSchema(`\n  type Query {\n    hello: String\n  }\n`);\n\nconst root = { \n  hello: () =\u003e 'Hello world'\n};\n\nugraphql(schema, root);\n\napp.listen(9001, token =\u003e token ? console.log('µGQL running on port 9001') : console.log('µGQL failed to run: port already in use'));\n```\n\nThen run\n```sh\nnode --experimental-modules app.mjs\n```\n\nQuick test, in a developer console\n```js\nfetch('http://localhost:9001/graphql', {\n  method: 'POST',\n  headers: {\n    'Content-Type': 'application/json'\n  },\n  body: JSON.stringify({ query: \"{ hello }\" })\n})\n  .then(r =\u003e r.json())\n  .then(console.log);\n```\n\nYou should see\n```js\nObject { hello: \"Hello world!\" }\n```\n\n# Supported request's types\n- GET with query parameter\n- POST with content-type\n    - application/json\n    - application/x-www-form-urlencoded\n    - application/graphql\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannihil%2Fugql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fannihil%2Fugql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fannihil%2Fugql/lists"}