File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ export function getSwaggerHtml(appPrefix: string): string {
2323</html>` ;
2424}
2525
26- export function getRootPageHtml ( apiPrefix : string ) : string {
26+ export function getRootPageHtml ( appPrefix : string , apiPrefix : string ) : string {
2727 return `<!DOCTYPE html>
2828<html lang="en">
2929<head>
@@ -46,11 +46,11 @@ export function getRootPageHtml(apiPrefix: string): string {
4646
4747 <p>A simple REST API service for managing items, built with Bun and PostgreSQL.</p>
4848
49- <p><a href="/docs" target="_blank">Swagger Docs</a></p>
49+ <p><a href="${ appPrefix } /docs" target="_blank">Swagger Docs</a></p>
5050
5151 <p><strong>API Endpoints:</strong></p>
52- <p><a href="${ apiPrefix } /health" target="_blank">${ apiPrefix } /health</a> - Service and database health check</p>
53- <p><a href="${ apiPrefix } /items" target="_blank">${ apiPrefix } /items</a> - List all items</p>
52+ <p><a href="${ appPrefix } / ${ apiPrefix } /health" target="_blank">${ apiPrefix } /health</a> - Service and database health check</p>
53+ <p><a href="${ appPrefix } / ${ apiPrefix } /items" target="_blank">${ apiPrefix } /items</a> - List all items</p>
5454 </article>
5555 </div>
5656</body>
Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ async function handle(req: Request): Promise<Response> {
9595 try {
9696 const body = ( await req . json ( ) ) as Partial < Item > ;
9797 if ( ! body ?. name || typeof body . name !== "string" ) return json ( { error : "name required" } , { status : 400 } ) ;
98+ response = new Response ( getRootPageHtml ( APP_PREFIX , API_PREFIX ) , { headers : { "content-type" : "text/html; charset=utf-8" } } ) ;
9899
99100 const [ item ] = await sql < Item [ ] > `
100101 INSERT INTO items (name)
You can’t perform that action at this time.
0 commit comments