Skip to content

Commit 1f65abe

Browse files
authored
docs(hello_world): create tutorial (#238)
1 parent f79815a commit 1f65abe

File tree

10 files changed

+129
-12
lines changed

10 files changed

+129
-12
lines changed

docs/docs/basics/_category_.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
2-
"label": "Basics 📚",
2+
"label": "Basics",
33
"position": 2,
44
"link": {
5+
"title": "Basics 📚",
56
"type": "generated-index",
6-
"description": "5 minutes to learn the most important Dart Frog concepts."
7+
"description": "Learn the most important Dart Frog concepts in just a few minutes."
78
}
89
}

docs/docs/deploy/_category_.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
{
2-
"label": "Deploy 🚀",
3-
"position": 3,
2+
"label": "Deploy",
3+
"position": 4,
44
"link": {
5+
"title": "Deploy ☁️",
56
"type": "generated-index",
67
"description": "Learn how to build and deploy your Dart Frog server in minutes."
78
}

docs/docs/overview.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
---
22
sidebar_position: 1
3+
title: Overview
34
---
45

56
# Overview 🎯

docs/docs/roadmap.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
sidebar_position: 5
3+
title: Roadmap
4+
---
5+
16
# Roadmap 🗺️
27

38
In the interest of transparency, we want to share high-level details of our roadmap, so that others can see our priorities and make plans based on the work we are doing.

docs/docs/tutorials/_category_.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"label": "Tutorials",
3+
"position": 3,
4+
"link": {
5+
"type": "generated-index",
6+
"description": "Step-by-step instructions for how to use Dart Frog with common use cases."
7+
}
8+
}

docs/docs/tutorials/hello_world.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
---
2+
sidebar_position: 1
3+
description: Build a simple "Hello World" application.
4+
---
5+
6+
# Hello World 🌍
7+
8+
:::info
9+
**Difficulty**: 🟢 Beginner<br/>
10+
**Length**: 5 minutes
11+
12+
Before getting started, [read the prerequisites](/docs/overview#prerequisites) to make sure your development environment is ready.
13+
:::
14+
15+
## Overview
16+
17+
In this tutorial, we're going to build an app that exposes a single endpoint and responds with a static response.
18+
19+
When we're done, we should be able to make a `GET` request to the `/` endpoint:
20+
21+
```bash
22+
curl --request GET \
23+
--url http://localhost:8080
24+
```
25+
26+
And our server should respond with the following response:
27+
28+
```
29+
HTTP/1.1 200 OK
30+
Connection: close
31+
Content-Length: 21
32+
Content-Type: text/plain; charset=utf-8
33+
Date: Thu, 04 Aug 2022 19:50:12 GMT
34+
35+
36+
Welcome to Dart Frog!
37+
```
38+
39+
## Creating a new app
40+
41+
To create a new Dart Frog app, open your terminal, `cd` into the directory where you'd like to create the app, and run the following command:
42+
43+
```bash
44+
dart_frog create hello_world
45+
```
46+
47+
You should see the following output:
48+
49+
```
50+
✓ Creating hello_world (0.1s)
51+
✓ Installing dependencies (1.7s)
52+
53+
Created hello_world at ./hello_world.
54+
55+
Get started by typing:
56+
57+
cd ./hello_world
58+
dart_frog dev
59+
```
60+
61+
## Running the development server
62+
63+
You should now have a directory called `hello_world` -- `cd` into it:
64+
65+
```bash
66+
cd hello_world
67+
```
68+
69+
Then, run the following command:
70+
71+
```bash
72+
dart_frog dev
73+
```
74+
75+
This will start the development server on port `8080`:
76+
77+
```
78+
✓ Running on http://localhost:8080 (1.3s)
79+
The Dart VM service is listening on http://127.0.0.1:8181/YKEF_nbwOpM=/
80+
The Dart DevTools debugger and profiler is available at: http://127.0.0.1:8181/YKEF_nbwOpM=/devtools/#/?uri=ws%3A%2F%2F127.0.0.1%3A8181%2FYKEF_nbwOpM%3D%2Fws
81+
[hotreload] Hot reload is enabled.
82+
```
83+
84+
Make sure it's working by opening [http://localhost:8080](http://localhost:8080) in your browser or via `cURL`:
85+
86+
```bash
87+
curl --request GET \
88+
--url http://localhost:8080
89+
```
90+
91+
If everything succeeded, you should see `Welcome to Dart Frog!`.
92+
93+
🎉 Congrats, you've created a `hello_world` application using Dart Frog. View the full source code [here](https://github.com/VeryGoodOpenSource/dart_frog/tree/main/examples/hello_world).

docs/docusaurus.config.js

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,15 @@ const config = {
6868
},
6969
{
7070
label: 'Basics',
71-
to: '/docs/category/basics-',
71+
to: '/docs/category/basics',
72+
},
73+
{
74+
label: 'Tutorials',
75+
to: '/docs/category/tutorials',
7276
},
7377
{
7478
label: 'Deploy',
75-
to: '/docs/category/deploy-',
79+
to: '/docs/category/deploy',
7680
},
7781
{
7882
label: 'Roadmap',
@@ -103,11 +107,15 @@ const config = {
103107
},
104108
{
105109
label: 'Basics',
106-
to: '/docs/category/basics-',
110+
to: '/docs/category/basics',
111+
},
112+
{
113+
label: 'Tutorials',
114+
to: '/docs/category/tutorials',
107115
},
108116
{
109117
label: 'Deploy',
110-
to: '/docs/category/deploy-',
118+
to: '/docs/category/deploy',
111119
},
112120
{
113121
label: 'Roadmap',
@@ -145,7 +153,7 @@ const config = {
145153
copyright: `Copyright © ${new Date().getFullYear()} Very Good Ventures.<br/>Built with 💙 by <a target="_blank" rel="noopener" aria-label="Very Good Ventures" href="https://verygood.ventures">Very Good Ventures</a>.`,
146154
},
147155
prism: {
148-
additionalLanguages: ['dart'],
156+
additionalLanguages: ['bash', 'dart'],
149157
theme: lightCodeTheme,
150158
darkTheme: darkCodeTheme,
151159
},

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"write-heading-ids": "docusaurus write-heading-ids"
1818
},
1919
"dependencies": {
20-
"@docusaurus/core": "^2.0.0-rc.1",
20+
"@docusaurus/core": "^2.0.1",
2121
"@docusaurus/preset-classic": "^2.0.1",
2222
"@mdx-js/react": "^1.6.22",
2323
"clsx": "^1.2.1",

docs/src/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ function CTAs() {
6060
</Link>
6161
<Link
6262
className="button button--secondary button--lg"
63-
to="/docs/category/basics-"
63+
to="/docs/category/basics"
6464
>
6565
Learn More
6666
</Link>

docs/yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,7 @@
13571357
"@docsearch/css" "3.1.1"
13581358
algoliasearch "^4.0.0"
13591359

1360-
"@docusaurus/[email protected]", "@docusaurus/core@^2.0.0-rc.1":
1360+
"@docusaurus/[email protected]", "@docusaurus/core@^2.0.1":
13611361
version "2.0.1"
13621362
resolved "https://registry.yarnpkg.com/@docusaurus/core/-/core-2.0.1.tgz#a2b0d653e8f18eacddda4778a46b638dd1f0f45c"
13631363
integrity sha512-Prd46TtZdiixlTl8a+h9bI5HegkfREjSNkrX2rVEwJZeziSz4ya+l7QDnbnCB2XbxEG8cveFo/F9q5lixolDtQ==

0 commit comments

Comments
 (0)