Skip to content

Commit 8c36e4b

Browse files
committed
chore: use new select ui for http router
Signed-off-by: Thorsten Hans <[email protected]>
1 parent c5535df commit 8c36e4b

File tree

4 files changed

+15
-7
lines changed

4 files changed

+15
-7
lines changed

templates/http-js/content/src/index.js.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ app.use(async (c, next) => {
1616
})
1717

1818
app.get('/', (c) => c.text('Hello, Spin!'));
19-
app.get('/:name', (c) => {
19+
app.get('/hello/:name', (c) => {
2020
return c.json({ message: `Hello, ${c.req.param('name')}` })
2121
});
2222

@@ -42,7 +42,7 @@ function handle(_request) {
4242
return new Response("Hello, Spin!", {
4343
status: 200,
4444
headers: {
45-
'content-type': 'application/json'
45+
'content-type': 'text/plain'
4646
}
4747
})
4848
}

templates/http-js/metadata/spin-template.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ component = "component.txt"
1010
[parameters]
1111
project-description = { type = "string", prompt = "Description", default = "" }
1212
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
13-
http-router = { type = "string", prompt = "HTTP Router", default = "itty", pattern = "^(itty|hono|none)$" }
13+
http-router = { type = "string", prompt = "HTTP Router", default = "itty", allowed_values = [
14+
"itty",
15+
"hono",
16+
"none",
17+
] }

templates/http-ts/content/src/index.ts.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ app.use(async (c: Context, next: Next) => {
1717
})
1818

1919
app.get('/', (c: Context) => c.text('Hello, Spin!'));
20-
app.get('/:name', (c: Context) => {
21-
return c.json({ message: `Hello, ${c.req.param('name')}` })
20+
app.get('/hello/:name', (c: Context) => {
21+
return c.json({ message: `Hello, ${c.req.param('name')}!` })
2222
});
2323

2424
app.fire();
@@ -44,7 +44,7 @@ function handle(_request: Request): Response {
4444
return new Response("Hello, Spin!", {
4545
status: 200,
4646
headers: {
47-
'content-type': 'application/json'
47+
'content-type': 'text/plain'
4848
}
4949
})
5050
}

templates/http-ts/metadata/spin-template.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@ component = "component.txt"
1010
[parameters]
1111
project-description = { type = "string", prompt = "Description", default = "" }
1212
http-path = { type = "string", prompt = "HTTP path", default = "/...", pattern = "^/\\S*$" }
13-
http-router = { type = "string", prompt = "HTTP Router", default = "itty", pattern = "^(itty|hono|none)$" }
13+
http-router = { type = "string", prompt = "HTTP Router", default = "itty", allowed_values = [
14+
"itty",
15+
"hono",
16+
"none",
17+
] }

0 commit comments

Comments
 (0)