mirror of
https://github.com/Ratstail91/sineQL.git
synced 2025-11-29 02:34:28 +11:00
Updated README.md
This commit is contained in:
20
README.md
20
README.md
@@ -95,7 +95,7 @@ module.exports = schema;
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
//there's a different handler object for query, create, update and delete
|
//there's a different handler object for query, create, update and delete
|
||||||
const queryHandler = {
|
const queryHandlers = {
|
||||||
Author: (query, graph) => {
|
Author: (query, graph) => {
|
||||||
//TODO: implement this
|
//TODO: implement this
|
||||||
},
|
},
|
||||||
@@ -104,7 +104,7 @@ const queryHandler = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = queryHandler;
|
module.exports = queryHandlers;
|
||||||
```
|
```
|
||||||
|
|
||||||
Create a matching client-side function pointing to the server.
|
Create a matching client-side function pointing to the server.
|
||||||
@@ -112,18 +112,18 @@ Create a matching client-side function pointing to the server.
|
|||||||
```js
|
```js
|
||||||
//create the wave function, wrapping a fetch to the server
|
//create the wave function, wrapping a fetch to the server
|
||||||
const wave = body => fetch('http://example.com/sineql', {
|
const wave = body => fetch('http://example.com/sineql', {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: {
|
headers: {
|
||||||
'Content-Type': 'text/plain'
|
'Content-Type': 'text/plain'
|
||||||
},
|
},
|
||||||
body: body
|
body: body
|
||||||
});
|
});
|
||||||
|
|
||||||
//get a list of content
|
//get a list of content
|
||||||
wave('Author { name books { title } }')
|
wave('Author { name books { title } }')
|
||||||
.then(blob => blob.text())
|
.then(blob => blob.text())
|
||||||
.then(text => console.log(text))
|
.then(text => console.log(text))
|
||||||
.catch(e => console.error(e))
|
.catch(e => console.error(e))
|
||||||
;
|
;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user