-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserver.js
38 lines (30 loc) · 1.06 KB
/
server.js
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
32
33
34
35
36
37
38
require('dotenv').config()
const express = require('express');
const cors = require("cors");
const dotenv = require("dotenv");
const helmet = require("helmet");
const morgan = require("morgan");
const path = require("path");
const { graphqlHTTP } = require('express-graphql');
const schema = require('./schema/schema')
const { CheckOut } = require('./controllers/CheckOut')
const app = express();
app.use(express.json());
//app.use(helmet());
//app.use(helmet.crossOriginResourcePolicy({policy: "cross-origin"}));
app.use(morgan("common"));
app.use(cors());
const PORT = process.env.PORT || 4000 ;
app.use('/', express.static(path.join(__dirname, 'public')))
app.use('/', require("./routes/root"))
app.use("/checkout", require("./routes/Check_out"))
app.use(
'/graphql',
graphqlHTTP({
schema,
graphiql: process.env.NODE_ENV === 'development',
})
);
app.use("/auth", require("./routes/AuthRoutes"))
//console.log(require('crypto').randomBytes(200).toString('base64'))
app.listen(PORT, () => console.log(`💻Server running on ${PORT}🔥🔥🚀🚀`))