All Projects â†’ Annihil â†’ ugql

Annihil / ugql

Licence: other
🚀GraphQL.js over HTTP with uWebSockets.js

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to ugql

String Hash
Get the hash of a string
Stars: ✭ 56 (+107.41%)
Mutual labels:  npm-package, node-module
Update Notifier
The idea for this module came from the desire to apply the browser update strategy to CLI tools, where everyone is always on the latest version. We first tried automatic updating, which we discovered wasn't popular. This is the second iteration of that idea, but limited to just update notifications.
Stars: ✭ 1,594 (+5803.7%)
Mutual labels:  npm-package, node-module
Node Loadbalance
A collection of distilled load balancing engines
Stars: ✭ 79 (+192.59%)
Mutual labels:  npm-package, node-module
Conf
Simple config handling for your app or module
Stars: ✭ 707 (+2518.52%)
Mutual labels:  npm-package, node-module
Singlespotify
🎵 Create Spotify playlists based on one artist through the command line
Stars: ✭ 254 (+840.74%)
Mutual labels:  npm-package, node-module
Is
Type check values
Stars: ✭ 1,011 (+3644.44%)
Mutual labels:  npm-package, node-module
P Queue
Promise queue with concurrency control
Stars: ✭ 1,863 (+6800%)
Mutual labels:  npm-package, node-module
midtrans-node
Unoffficial Midtrans Payment API Client for Node JS | Alternative for Midtrans Official Module | https://midtrans.com
Stars: ✭ 15 (-44.44%)
Mutual labels:  npm-package, node-module
Gh Got
Convenience wrapper for Got to interact with the GitHub API
Stars: ✭ 156 (+477.78%)
Mutual labels:  npm-package, node-module
Transliterate
Convert Unicode characters to Latin characters using transliteration
Stars: ✭ 152 (+462.96%)
Mutual labels:  npm-package, node-module
Node Module Boilerplate
Boilerplate to kickstart creating a Node.js module
Stars: ✭ 668 (+2374.07%)
Mutual labels:  npm-package, node-module
graphql-express-nodejs
A Simple GraphQL Server implementation using Express and Node. See post here: https://t.co/Cm6GitZaBL
Stars: ✭ 24 (-11.11%)
Mutual labels:  graphql-server, graphql-js
Rando.js
The world's easiest, most powerful random function.
Stars: ✭ 659 (+2340.74%)
Mutual labels:  npm-package, node-module
Awesome Node Utils
some useful npm packages for nodejs itself
Stars: ✭ 51 (+88.89%)
Mutual labels:  npm-package, node-module
Figures
Unicode symbols with Windows CMD fallbacks
Stars: ✭ 438 (+1522.22%)
Mutual labels:  npm-package, node-module
Fnv1a
FNV-1a non-cryptographic hash function
Stars: ✭ 101 (+274.07%)
Mutual labels:  npm-package, node-module
djb2a
DJB2a non-cryptographic hash function
Stars: ✭ 31 (+14.81%)
Mutual labels:  npm-package, node-module
sdbm
SDBM non-cryptographic hash function
Stars: ✭ 43 (+59.26%)
Mutual labels:  npm-package, node-module
Aws Lambda Libreoffice
85 MB LibreOffice to fit inside AWS Lambda compressed with Brotli
Stars: ✭ 145 (+437.04%)
Mutual labels:  npm-package, node-module
graphql-directive-rest
GraphQL directive for easy integration with REST API
Stars: ✭ 39 (+44.44%)
Mutual labels:  graphql-server, graphql-js

µGQL

npm License: MIT package dependencies
Leveraging GraphQL-js with µWebSockets.js

Installation

npm i ugql or yarn add ugql

Usage

Create an app.mjs file with the following content:

import uWS from 'uWebSockets.js';
import gql from 'graphql';
import ugql from 'ugql';

const { buildSchema } = gql;
const app = uWS.App();
const ugraphql = ugql(app, async (res, req) => ({})/* middleware */, true /* cors */);

const schema = buildSchema(`
  type Query {
    hello: String
  }
`);

const root = { 
  hello: () => 'Hello world'
};

ugraphql(schema, root);

app.listen(9001, token => token ? console.log('µGQL running on port 9001') : console.log('µGQL failed to run: port already in use'));

Then run

node --experimental-modules app.mjs

Quick test, in a developer console

fetch('http://localhost:9001/graphql', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ query: "{ hello }" })
})
  .then(r => r.json())
  .then(console.log);

You should see

Object { hello: "Hello world!" }

Supported request's types

  • GET with query parameter
  • POST with content-type
    • application/json
    • application/x-www-form-urlencoded
    • application/graphql
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].