-
Notifications
You must be signed in to change notification settings - Fork 0
/
dev.js
26 lines (23 loc) · 791 Bytes
/
dev.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
const express = require("express");
const app = express();
const nunjucks = require("nunjucks");
const path = require("path");
const fs = require("fs");
app.get("/", (req, res) => {
const fontAwesomePath = path.join(__dirname, "_lib", "fa-solid-900.ttf");
res.contentType("html");
res.send(
nunjucks.render(path.join(__dirname, "views", "index.html"), {
hand: JSON.parse(req.query.hand),
table: JSON.parse(req.query.table),
fontAwesome: fs.readFileSync(fontAwesomePath).toString("base64"),
wildBackground: fs
.readFileSync(path.join(__dirname, "_lib", "wild.svg"))
.toString("base64"),
})
);
});
app.get("/image", (req, res) => {
require("./api/image")(req, res, true);
});
app.listen(3000, () => console.log("Server started!"));