-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
38 lines (29 loc) · 899 Bytes
/
Copy pathindex.js
File metadata and controls
38 lines (29 loc) · 899 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
32
33
34
35
36
37
38
const express = require("express");
const https = require("https");
const fs = require("fs");
const { stringify } = require("querystring");
const { type } = require("express/lib/response");
const app = express();
const port = 10045;
const path = "F:/Sublime Text (4121)/dailyFun";
app.use(express.urlencoded({ extended: true }));
app.use(express.json());
app.post("/", (req, res) => {
const data = req.body;
// console.log(data);
let inputs = "";
let tests = data.tests;
inputs += String(tests.length) + "\n";
console.log(tests);
tests.forEach((test) => {
inputs += test.input;
});
// console.log(typeof inputs);
fs.writeFile(path + "/input.txt", inputs, "utf8", (e) => {
if (e) console.log(e);
});
console.log("tests parsed");
});
app.listen(port, (req, res) => {
console.log(`server is listening on ${port}`);
});