Skip to content

Commit 0bc95a7

Browse files
committed
Added github test workflow and moved admin page to index
1 parent f9e0009 commit 0bc95a7

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/test.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: npm
18+
- run: npm ci
19+
- run: npm run typecheck
20+
- run: npm test

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# Avalanche Canada SMS Service
22

3+
[![Tests](https://github.com/GenerationSoftware/avalanche-canada-sms/actions/workflows/test.yml/badge.svg)](https://github.com/GenerationSoftware/avalanche-canada-sms/actions/workflows/test.yml)
4+
35
A serverless application that lets users text their GPS coordinates to a phone number and receive a summary of current avalanche conditions from [Avalanche Canada](https://avalanche.ca) for that location.
46

57
## How It Works

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export type Env = {
1414
const app = new Hono<{ Bindings: Env }>();
1515

1616
app.route("/sms", smsRoutes);
17-
app.route("/admin", adminRoutes);
17+
app.route("/", adminRoutes);
1818
app.route("/", healthRoutes);
1919

2020
export default app;

src/templates/admin.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ <h1>Avalanche SMS</h1>
4545
var ov = document.getElementById('overall');
4646
ov.className = 'overall loading';
4747
ov.textContent = 'Checking...';
48-
fetch('/admin/status').then(function(r) { return r.json(); }).then(function(data) {
48+
fetch('/status').then(function(r) { return r.json(); }).then(function(data) {
4949
ov.className = 'overall ' + data.overall;
5050
ov.textContent = labels[data.overall] || data.overall;
5151
var container = document.getElementById('services');

0 commit comments

Comments
 (0)