-
Notifications
You must be signed in to change notification settings - Fork 1
/
app.js
43 lines (37 loc) · 1.15 KB
/
app.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
40
41
42
43
const express = require("express");
const { graphqlHTTP } = require("express-graphql");
const cors = require("cors");
const schema = require("./schema");
const convertRawToJson = require("./data/raw/rawToJson");
const port = process.env.PORT || 3000;
const app = express();
app.use(cors());
app.use(
"/graphql",
graphqlHTTP({
schema,
graphiql: true,
})
);
app.get("/raw-to-json", (req, res, next) => {
const before = new Date();
convertRawToJson();
const after = new Date();
res.send(`finish in ${(after - before) / 1000} seconds`);
});
app.get("/", (req, res, next) => {
res.send(`
<p>
Hai! Silahkan menuju ke <a href="/graphql">GraphiQL<a> untuk menguji data yang dapat diambil
</p>
<p>
Sumber Data : <a href="https://pddikti.kemdikbud.go.id/pt">https://pddikti.kemdikbud.go.id/pt<a> (diakses pada 22 November 2021, 14.13 WIB)
</p>
<p>
Link File Excel Asli: <a href="http://pddikti.ristekdikti.go.id/public/asset/data/Data_Perguruan_Tinggi.xlsx">http://pddikti.ristekdikti.go.id/public/asset/data/Data_Perguruan_Tinggi.xlsx<a>
</p>
`);
});
app.listen(port, () => {
console.log("server started");
});