Skip to content

Instantly share code, notes, and snippets.

@ivanbtrujillo
Last active June 18, 2017 13:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ivanbtrujillo/0e2e2853e4d45b2810173b0821b07e48 to your computer and use it in GitHub Desktop.
Save ivanbtrujillo/0e2e2853e4d45b2810173b0821b07e48 to your computer and use it in GitHub Desktop.
GraphQL. 02 - Servidor en Node con Express - 02
const express = require('express'),
// Llamamos a la librería express-graphql
expressGraphQL = require('express-graphql');
const app = express();
/*
Indicamos a nuestra aplicación express que para las peticiones al
endpoint /graphql, delegaremos la gestion en la libreria expressGraphQL a la cual
habilitamos la interfaz web graphiql, que nos permite operar con graphQL facilmente.
*/
app.use('/graphql', expressGraphQL({
graphiql: true
}));
app.listen(4000, (err, res) => {
if (err)
console.log(`Error: ${err}`);
else
console.log('Servidor express funcionando en el puerto 4000')
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment