Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
sdiricco committed Jun 18, 2024
0 parents commit ac3a3b1
Show file tree
Hide file tree
Showing 4 changed files with 829 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
27 changes: 27 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
const express = require('express');
const { graphqlHTTP } = require('express-graphql');
const { buildSchema } = require('graphql');
const cors = require('cors')

// Definisci uno schema GraphQL
const schema = buildSchema(`
type Query {
hello: String
}
`);

// Definisci un resolver
const root = {
hello: () => 'Hello world!'
};

// Configura Express per usare GraphQL
const app = express();
app.use(cors());
app.use('/graphql', graphqlHTTP({
schema: schema,
rootValue: root,
graphiql: true
}));

app.listen(4000, () => console.log('Server GraphQL in esecuzione su http:https://localhost:4000/graphql'));
Loading

0 comments on commit ac3a3b1

Please sign in to comment.