Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,16 @@ Este repo está basado en la charla `Probablemente necesites GraphQL`
## Ejemplos:

### Minimal
Contiene lo minimo para empezar un server con GraphQL usando Express
Contiene lo minimo para empezar un server con GraphQL usando Express.

1. Corré: `npm run minimal` o `yarn minimal`
2. El servidor ya está corriendo en localhost. `http://localhost:3000/?query=%7B%0A%20%20hello%0A%7D`
2. El servidor ya está corriendo en localhost . `http://localhost:3001/?query=%7B%0A%20%20hello%0A%7D`

### Server
Contiene lo minimo para empezar un server con GraphQL usando Express pero estructurado de una forma más clara.

1. Corré: `npm run server` o `yarn server`
2. El servidor ya está corriendo en localhost . `http://localhost:3000/?query=%7B%0A%20%20hello%0A%7D`


❤️ Creado por Belen Curcio @okbel
Expand Down
4 changes: 2 additions & 2 deletions examples/minimal-server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const root = {
hello: () => 'world!',
};

// POST endpoint
app.post('/graph', async ({body: {query}}, res) =>
// GET endpoint
app.get('/graph', async ({body: {query}}, res) =>
res.json(await graphql(schema, query, root))
);

Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"author": "Belen Curcio <curciobelen@gmail.com>",
"license": "MIT",
"scripts": {
"minimal": "cd examples/minimal && node index"
"minimal": "cd examples/minimal-server && node server.js",
"server": "cd examples/server && node index"
},
"dependencies": {
"body-parser": "^1.17.1",
Expand Down