Skip to content

Commit 52dda63

Browse files
committed
Added code sha to no standard star handler
1 parent 8261ee8 commit 52dda63

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
Implements the Expressjs Hello World example to provide faster start deploying on Cyclic platform
44

5-
65
## Installation
76

87
- Fork this repo

app.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,28 @@
11
const express = require('express')
22
const app = express()
3+
const fs = require('fs')
4+
5+
const VERSION_FILENAME='./.git/refs/heads/main'
36

47
app.get('/', (req, res) => {
58
console.log('[hello-world] root handler called')
69
res
710
.set('x-powered-by', 'cyclic.sh')
8-
.send('Hello World!')
11+
.send('<h1>Hello World!</h1>')
912
.end()
1013
})
1114

1215
app.use('*', (req,res) => {
1316
console.log('[hello-world] Star handler called')
17+
let version = 'unknown'
18+
if (fs.existsSync(VERSION_FILENAME)) {
19+
version = fs.readFileSync(VERSION_FILENAME).toString()
20+
}
1421
res
1522
.set('x-powered-by', 'cyclic.sh')
1623
.json({
1724
msg: "Not strickly part of the hello world but you get the picture.",
25+
version,
1826
at: new Date().toISOString(),
1927
method: req.method,
2028
hostname: req.hostname,

0 commit comments

Comments
 (0)