Skip to content

Commit f2ea791

Browse files
committed
docs: update caddy docs
1 parent f9fb548 commit f2ea791

File tree

615 files changed

+46648
-8898
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

615 files changed

+46648
-8898
lines changed

docs/caddy/docs/docs/api-tutorial.md renamed to docs/caddy/api-tutorial.md

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -24,20 +24,14 @@ This tutorial will show you how to use Caddy's [admin API](https://caddyserver.c
2424

2525
To start the Caddy daemon, use the `run` subcommand:
2626

27-
```
28-
caddy run
29-
```
30-
27+
`caddy run`
3128
This blocks forever, but what is it doing? At the moment... nothing. By default, Caddy's configuration ("config") is blank. We can verify this using the [admin API](https://caddyserver.com/docs/api) in another terminal:
3229

33-
```
34-
curl localhost:2019/config/
35-
```
36-
30+
`curl localhost:2019/config/`
3731
We can make Caddy useful by giving it a config. One way to do this is by making a POST request to the [/load](https://caddyserver.com/docs/api#post-load) endpoint. Just like any HTTP request, there are many ways to do this, but in this tutorial we'll use `curl`.
3832

39-
Your first config[🔗](https://caddyserver.com/docs/api-tutorial#your-first-config "Direct link")
40-
------------------------------------------------------------------------------------------------
33+
Your first config
34+
-----------------
4135

4236
To prepare our request, we need to make a config. Caddy's configuration is simply a [JSON document](https://caddyserver.com/docs/json/) (or [anything that converts to JSON](https://caddyserver.com/docs/config-adapters)).
4337

@@ -75,10 +69,7 @@ curl localhost:2019/load \
7569

7670
We can verify that Caddy applied our new config with another GET request:
7771

78-
```
79-
curl localhost:2019/config/
80-
```
81-
72+
`curl localhost:2019/config/`
8273
Test that it works by going to [localhost:2015](http://localhost:2015/) in your browser or using `curl`:
8374

8475
```
@@ -107,14 +98,11 @@ curl localhost:2019/load \
10798

10899
For good measure, verify that the config was updated:
109100

110-
```
111-
curl localhost:2019/config/
112-
```
113-
101+
`curl localhost:2019/config/`
114102
Test it by refreshing the page in your browser (or running `curl` again), and you will see an inspirational message!
115103

116-
Config traversal[🔗](https://caddyserver.com/docs/api-tutorial#config-traversal "Direct link")
117-
----------------------------------------------------------------------------------------------
104+
Config traversal
105+
----------------
118106

119107
Instead of uploading the entire config file for a small change, let's use a powerful feature of Caddy's API to make the change without ever touching our config file.
120108

@@ -129,10 +117,7 @@ curl \
129117

130118
You can verify that it worked with a similar GET request, for example:
131119

132-
```
133-
curl localhost:2019/config/apps/http/servers/example/routes
134-
```
135-
120+
`curl localhost:2019/config/apps/http/servers/example/routes`
136121
You should see:
137122

138123
```
@@ -145,8 +130,8 @@ You should see:
145130
* Don't mix the use of config files with changes via the API; have one source of truth.
146131
* [Export Caddy's new configuration](https://caddyserver.com/docs/api#get-configpath) with a subsequent GET request (less recommended than the first two options).
147132

148-
Using `@id` in JSON[🔗](https://caddyserver.com/docs/api-tutorial#using-id-in-json "Direct link")
149-
-------------------------------------------------------------------------------------------------
133+
Using `@id` in JSON
134+
-------------------
150135

151136
Config traversal is certainly useful, but the paths are little long, don't you think?
152137

@@ -171,10 +156,7 @@ This adds a property to our handler object: `"@id": "msg"`, so it now looks like
171156

172157
We can then access it directly:
173158

174-
```
175-
curl localhost:2019/id/msg
176-
```
177-
159+
`curl localhost:2019/id/msg`
178160
And now we can change the message with a shorter path:
179161

180162
```
@@ -186,6 +168,4 @@ curl \
186168

187169
And check it again:
188170

189-
```
190-
curl localhost:2019/id/msg/body
191-
```
171+
`curl localhost:2019/id/msg/body`

docs/caddy/docs/docs/api.md renamed to docs/caddy/api.md

Lines changed: 67 additions & 77 deletions
Large diffs are not rendered by default.

docs/caddy/docs/docs/architecture.md renamed to docs/caddy/architecture.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ The core of Caddy knows how to work with some of these fields natively:
4343

4444
But other top-level fields (like [`apps`](https://caddyserver.com/docs/json/apps/)) are opaque to the core of Caddy. In fact, all Caddy knows to do with the bytes in `apps` is deserialize them into an interface type that it can call two methods on:
4545

46-
1. `Start()`
47-
2. `Stop()`
46+
1. `Start()`
47+
2. `Stop()`
4848

4949
... and that's it. It calls `Start()` on each app when a config is loaded, and `Stop()` on each app when a config is unloaded.
5050

@@ -61,10 +61,10 @@ There are two kinds of modules: _host modules_ and _guest modules_.
6161

6262
Modules get loaded, are provisioned and validated, get used, then are cleaned up, in this sequence:
6363

64-
1. Loaded
65-
2. Provisioned and validated
66-
3. Used
67-
4. Cleaned up
64+
1. Loaded
65+
2. Provisioned and validated
66+
3. Used
67+
4. Cleaned up
6868

6969
Caddy kicks off the module lifecycle when a config is loaded first by initializing all the configured app modules. From there, it's turtles all the way down as each app module takes it the rest of the way.
7070

0 commit comments

Comments
 (0)