Skip to content

Commit 0d74cef

Browse files
Health checks
1 parent f920fb2 commit 0d74cef

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

main.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@
4949
uvPath()
5050

5151
# Other routes
52+
get '/rubyHealth/?' do
53+
return "OK"
54+
end
55+
5256
get '/:unlock?' do
5357
erb :index, :layout => :"layouts/index"
5458
end

node-server/server-dev.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,16 @@ app.get('/search=:query', async (req, res) => {
8585
app.get('/version', async (req, res) => {
8686
res.send({ version: latestRelease });
8787
});
88+
app.get('/health', async (req, res) => {
89+
//get the /rubyHealth response
90+
const resp = await fetch(`http://localhost:${rubyPort}/rubyHealth`);
91+
if (resp.status === 200) {
92+
res.send({ status: 'ok' });
93+
}
94+
else {
95+
res.send({ status: 'error' });
96+
}
97+
});
8898

8999
app.listen({ port: nodePort, host: '0.0.0.0' });
90100
console.log(chalk.green(`Server listening on port ${chalk.red(nodePort)}`));

node-server/server.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,15 @@ app.get('/search=:query', async (req, res) => {
8585
app.get('/version', async (req, res) => {
8686
res.send({ version: latestRelease });
8787
});
88+
app.get('/health', async (req, res) => {
89+
let resp = await fetch(`http://localhost:${rubyPort}/rubyHealth`);
90+
if (resp.status === 200) {
91+
res.send({ status: 'ok' });
92+
}
93+
else {
94+
res.send({ status: 'error' });
95+
}
96+
}
8897

8998
app.listen({ port: nodePort, host: '0.0.0.0' });
9099
console.log(chalk.green(`Server listening on port ${chalk.red(nodePort)}`));

src/public/js/uv/uv.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
self.__uv$config = {
22
prefix: '/js/sw/service/uv/',
3-
bare: '/bare/',
3+
bare: 'http://localhost:4000/',
44
encodeUrl: Ultraviolet.codec.xor.encode,
55
decodeUrl: Ultraviolet.codec.xor.decode,
66
handler: '/uv/uv.handler.js',

0 commit comments

Comments
 (0)