Set route for compilation

This commit is contained in:
Ash
2023-01-30 12:20:14 +04:00
parent 9642f8acf5
commit 18732874dc
3 changed files with 29 additions and 3 deletions

View File

@@ -70,8 +70,29 @@ app.post("/getlastversion", jsonParser, function(request, response_getlastversio
});
app.use(express.static(__dirname + "/public"));
app.use(express.static(__dirname + "/public", { refresh: true }));
app.use('/backgrounds', (req, res) => {
const filePath = path.join(process.cwd(), 'public/backgrounds', req.url);
fs.readFile(filePath, (err, data) => {
if (err) {
res.status(404).send('File not found');
return;
}
//res.contentType('image/jpeg');
res.send(data);
});
});
app.use('/characters', (req, res) => {
const filePath = path.join(process.cwd(), 'public/characters', req.url);
fs.readFile(filePath, (err, data) => {
if (err) {
res.status(404).send('File not found');
return;
}
//res.contentType('image/jpeg');
res.send(data);
});
});
app.use(multer({dest:"uploads"}).single("avatar"));
app.get("/", function(request, response){
    response.sendFile(__dirname + "/public/index.html");