diff --git a/config.yaml b/config.yaml index 6d99d49dbbc..3609a10471c 100644 --- a/config.yaml +++ b/config.yaml @@ -5,9 +5,13 @@ theme: hugo-fresh menu: docs: + - identifier: getting-started + name: Getting started + url: /docs/getting-started/ + weight: 100 - identifier: tutorials name: Tutorials - url: /docs/tutorials + url: /docs/tutorials/ weight: 200 - identifier: spec name: Specification diff --git a/content/docs/getting-started.md b/content/docs/getting-started/_index.md similarity index 99% rename from content/docs/getting-started.md rename to content/docs/getting-started/_index.md index 48abf860a73..1eb9c0fdacd 100644 --- a/content/docs/getting-started.md +++ b/content/docs/getting-started/_index.md @@ -1,9 +1,8 @@ --- title: "Getting started" date: 2019-02-16T13:56:52+01:00 -menu: - docs: -weight: 100 +categories: +- getting-started aliases: - '/v1/guide/' - '/v1/guide/index.html' diff --git a/content/docs/getting-started/hello-world.md b/content/docs/getting-started/hello-world.md new file mode 100644 index 00000000000..4777ac24273 --- /dev/null +++ b/content/docs/getting-started/hello-world.md @@ -0,0 +1,82 @@ +--- +title: "Hello world" +date: 2019-04-01T10:56:52+01:00 +menu: + docs: + parent: 'getting-started' +weight: 101 +--- + +Let's define an application that's capable of receiving a "hello {name}" message. + +```yaml +asyncapi: '2.0.0' +id: hello-world-app +channels: + hello: + subscribe: + message: + payload: + type: string + pattern: '^hello .+$' +``` + +Let's get into the details of the sample specification: + +
asyncapi: '2.0.0'
+id: hello-world-app
+channels:
+  hello:
+    subscribe:
+      message:
+        payload:
+          type: string
+          pattern: '^hello .+$'
+ +The first line of the specification starts with the document type (AsyncAPI) and the version (2.0.0). This line doesn't have to be the first one but it's a recommended practice. + +The second line identifies the application and is both required and unique. In a real environment using 'urn:com:mycompany:hello-world-app' is preferred rather than 'hello-world-app', for example. + +
asyncapi: '2.0.0'
+id: hello-world-app
+channels:
+  hello:
+    subscribe:
+      message:
+        payload:
+          type: string
+          pattern: '^hello .+$'
+ +The 'channels' section of the specification houses all of the mediums where messages flow through. For example, some systems use 'topic, 'event name' or 'routing key'. Different kinds of information flow through each channel similar to the analogy of TV channels. + +In our example, we only have one channel called `hello`. The sample app subscribes to this channel to receive "hello {name}" messages. + +
asyncapi: '2.0.0'
+id: hello-world-app
+channels:
+  hello:
+    subscribe:
+      message:
+        payload:
+          type: string
+          pattern: '^hello .+$'
+ +You can read the highlighted lines as "this is the **payload** of the **message** your app is **subscribed** to on the «**hello**» channel". + +
asyncapi: '2.0.0'
+id: hello-world-app
+channels:
+  hello:
+    subscribe:
+      message:
+        payload:
+          type: string
+          pattern: '^hello .+$'
+ +The 'payload' object defines how the message must be structured. In this example, the message must be a string and match the given regular expression in the format "hello {name}" string. + +## Conclusion + +We've seen how to define our simple Hello World app but, **how do we send a message to our Hello World application?** + +Go to the next chapter to [learn more about the `servers` property](/docs/servers). diff --git a/themes/hugo-fresh/layouts/_default/list.html b/themes/hugo-fresh/layouts/_default/list.html index 7194183d2ec..6baa8a69441 100644 --- a/themes/hugo-fresh/layouts/_default/list.html +++ b/themes/hugo-fresh/layouts/_default/list.html @@ -1,17 +1,21 @@ {{ define "main" }}
-
+
{{ partial "docs/sidebar.html" . }}
-

{{ .Title }}

-
- {{ range .Pages }} - {{.Title}} - {{ .Render "summary"}} - {{ end }} -
+ {{ if .Content }} + {{ partial "docs/content.html" . }} + {{ else }} +

{{ .Title }}

+
+ {{ range .Pages }} + {{.Title}} + {{ .Render "summary"}} + {{ end }} +
+ {{ end }}
diff --git a/themes/hugo-fresh/layouts/docs/single.html b/themes/hugo-fresh/layouts/docs/single.html index bfd6c0c2f7e..950db12da04 100644 --- a/themes/hugo-fresh/layouts/docs/single.html +++ b/themes/hugo-fresh/layouts/docs/single.html @@ -1,7 +1,7 @@ {{ define "main" }}
-
+
{{ partial "docs/sidebar.html" . }}
diff --git a/themes/hugo-fresh/layouts/partials/docs/sidebar.html b/themes/hugo-fresh/layouts/partials/docs/sidebar.html index 9c5b061d6ea..c9314d6c76c 100644 --- a/themes/hugo-fresh/layouts/partials/docs/sidebar.html +++ b/themes/hugo-fresh/layouts/partials/docs/sidebar.html @@ -5,10 +5,14 @@

Menu

{{ range .Site.Menus.docs }} {{ if .HasChildren }}
  • - - {{ .Pre }} - {{ .Name }} - + {{ if $currentPage.IsMenuCurrent "docs" . }} + {{ .Name }} + {{ else }} + + {{ .Pre }} + {{ .Name }} + + {{ end }}