-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
28 lines (18 loc) · 906 Bytes
/
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
global.__rootdir = __dirname;
const express = require("express");
const bodyParser = require("body-parser");
const config = require(__rootdir + "/config.json");
const {prepareGraders} = require(__rootdir + "/server/util.js");
const PORT = process.env.PORT || 3000;
const app = express();
app.use(bodyParser.urlencoded({extended: true}));
app.use(bodyParser.json());
prepareGraders();
console.log(`Using graders: ${JSON.stringify(config.graders)}`);
app.use("/status", require(__rootdir + "/server/status.js"));
app.use("/upload", require(__rootdir + "/server/upload.js"));
app.use("/run", require(__rootdir + "/server/run.js"));
app.get("/langs", (req, res) => res.send(config.langs));
app.get("/graders", (req, res) => res.send({ graders: config.graders}));
const server = app.listen(PORT, () => console.log(`Started cirrus at port ${PORT}`));
module.exports = server;