Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

graphql-http

Package Overview
Dependencies
Maintainers
3
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graphql-http - npm Package Compare versions

Comparing version 0.0.5 to 0.1.0

.eslintrc.json

19

package.json
{
"name": "graphql-http",
"version": "0.0.5",
"version": "0.1.0",
"description": "A GraphQL client for executing GraphQL queries over HTTP.",
"main": "index.dist.js",
"scripts": {
"dev": "babel --watch index.js --out-file index.dist.js"
"test": "eslint lib && jest"
},

@@ -28,14 +27,12 @@ "repository": {

"dependencies": {
"axios": "^0.11.0"
"isomorphic-fetch": "^2.2.1",
"lodash.merge": "^4.0.0"
},
"peerDependencies": {},
"devDependencies": {
"babel-cli": "^6.6.5",
"babel-eslint": "^6.0.0",
"babel-plugin-transform-runtime": "^6.8.0",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-0": "^6.5.0",
"babel-runtime": "^6.6.1",
"eslint": "^2.4.0"
"eslint": "^3.9.0",
"eslint-config-semistandard": "^7.0.0",
"fetch-mock": "^5.5.0",
"jest": "^16.0.2"
}
}

@@ -8,12 +8,47 @@ # graphql-http

```javascript
import graphQLHTTP from 'graphql-http'
```js
import { GQLClient } from 'graphql-http';
const client = graphQLHTTP('http://localhost:3000');
const client = GQLClient('http://localhost:3000', {
// anything passed here is merged with
// the options passed to fetch()
credentials: true,
headers: {
'X-Requested-With': 'XMLHttpRequest'
}
});
```
// Queries
let resultPromise = c.query('{ users { id, name }}');
Queries
// Mutations
let resultPromise = c.mutate('mutation {updateUser}');
```js
client.query(`
query ($id: RecordID!) {
user(id: $id) {
id
name
}
}
`, { id: 1234 }).then((result) => {
console.log(result.data.user);
// => { id: 1234, name: ... }
});
```
Mutations
```js
client.mutate(`
mutation ($id: RecordID!, $name: String!) {
updateUser(input: {id: $id, name: $name}) {
user {
id
name
}
}
}
`, { id: 1234, name: 'Danny' }).then((result) => {
console.log(result.data.user);
// => { id: 1234, name: 'Danny' }
});
```

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc