-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
31 lines (24 loc) · 662 Bytes
/
app.js
File metadata and controls
31 lines (24 loc) · 662 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var express = require("express");
var bodyParser = require("body-parser");
var cors = require("cors");
var { graphqlHTTP } = require("express-graphql");
const graphqlSchema = require("./graphql/schema");
const graphqlResolver = require("./graphql/resolvers");
const Appointment = require("./models/appointmentModel");
var app = express();
// Global Middlewares
// Implement CORS
app.use(cors());
app.use(bodyParser.json());
app.use(
"/graphql",
graphqlHTTP({
schema: graphqlSchema,
rootValue: graphqlResolver,
graphiql: true,
})
);
app.use("/", (req, res) => {
res.send("Beverly Hills Backend try /graphql");
});
module.exports = app;