From bcc3ac296dab7b148a8460499dfd7a9c9c51ccec Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Tue, 17 Dec 2024 06:21:51 +1100 Subject: [PATCH] Updated tutorial. Fixed sidebar --- docs/astro.config.mjs | 1 + .../docs/tutorials/01-creating-a-service.mdx | 40 ++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 2f117244e..00285d9be 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -83,6 +83,7 @@ export default defineConfig({ }, { label: "Tutorials", + collapsed: true, autogenerate: { directory: "tutorials", collapsed: true }, }, { diff --git a/docs/src/content/docs/tutorials/01-creating-a-service.mdx b/docs/src/content/docs/tutorials/01-creating-a-service.mdx index ecd3c2974..ce7964e04 100644 --- a/docs/src/content/docs/tutorials/01-creating-a-service.mdx +++ b/docs/src/content/docs/tutorials/01-creating-a-service.mdx @@ -370,7 +370,45 @@ This will show you how to organize your code into reusable services and handle e } ``` - Update `main.js` to make the image source the path to the QR code service, passing the text as a query parameter: + Now update `main.go` to specify the route that the QR code service should be accessible on: + + ```go title="main.go" ins={8-10} + func main() { + + app := application.New(application.Options{ + Name: "myproject", + Description: "A demo of using raw HTML & CSS", + LogLevel: slog.LevelDebug, + Services: []application.Service{ + application.NewService(NewQRService(), application.ServiceOptions{ + Route: "/qrservice", + }), + }, + Assets: application.AssetOptions{ + Handler: application.AssetFileServerFS(assets), + }, + Mac: application.MacOptions{ + ApplicationShouldTerminateAfterLastWindowClosed: true, + }, + }) + + app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{ + Title: "myproject", + Width: 600, + Height: 400, + }) + + // Run the application. This blocks until the application has been exited. + err := app.Run() + + // If an error occurred while running the application, log it and exit. + if err != nil { + log.Fatal(err) + } + } + ``` + + Finally, update `main.js` to make the image source the path to the QR code service, passing the text as a query parameter: ```js title="frontend/src/main.js" import { GenerateQRCode } from './bindings/changeme/qrservice.js';