Skip to content

Commit

Permalink
feat: Adds /version endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ViMaSter committed Oct 28, 2023
1 parent db603ef commit 939324c
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
8 changes: 8 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const { execSync } = require('child_process');
const { writeFileSync } = require('fs');
const { join } = require('path');

const versionFile = join(__dirname, 'public/views/version.html');
const version = execSync('git rev-parse HEAD').toString().trim();

writeFileSync(versionFile, version);
5 changes: 4 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ app.get("/contact", (req, res) => {

app.get("/epik", (req, res) => {
return res.sendFile("epik.html", { root: "public/views" });
//return res.sendFile("damedaepik.mp4", { root: "public/assets" });
});

app.get("/version", (req, res) => {
return res.sendFile("version.html", { root: "public/views" });
});

app.post("/contact", (req, res) => {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
"start": "node index.js",
"build": "node build.js"
},
"repository": {
"type": "git",
Expand Down
1 change: 1 addition & 0 deletions public/views/version.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
LOCAL

0 comments on commit 939324c

Please sign in to comment.