-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
executable file
·39 lines (33 loc) · 1.1 KB
/
index.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
39
const path = require("path");
const express = require("express");
const bodyParser = require("body-parser");
const pagesRoutes = require("./pages/routes");
const graphqlRoutes = require("./graphql/routes");
const app = express();
app.use(bodyParser.json());
app.use("/graphql", graphqlRoutes);
//app.use("/", pagesRoutes);
app.use(express.static(path.join(__dirname, "public")));
app.set("view engine", "hbs");
// app.get("/event/get:event_id", function (req, res) {
// var options = {
// host: "localhost",
// port: 3000,
// path:
// "/graphql?query={event(id:" +
// req.params.event_id +
// "){title,id,dateStart,dateEnd,room{title},users{login}}}",
// method: "GET",
// };
// http.get(options, function (res1) {
// res1.setEncoding("utf-8");
// res1.on("data", function (chunk) {
// var resObj = JSON.parse(chunk);
// res.json(resObj.data.event);
// });
// });
// });
// app.get("/event", function (r, s) {
// s.sendFile(__dirname + "/public/newEvent.html");
// });
app.listen(3000, () => console.log("Express app listening on localhost:3000"));