Skip to content

Commit

Permalink
add new sections for a little more explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacdonaldson committed Oct 8, 2024
1 parent e544fa4 commit a5ce639
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions docs-site/content/docs/getting-started/tour/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ If you select all defaults, you'll have:


Now `cd` into your `myapp` and start your app by running `cargo loco start`:


<div class="infobox">

If you have the `Client` asset serving option configured, make sure you build your frontend before starting the server. This can be done by changing into the frontend directory (`cd frontend`) and running `pnpm install` and `pnpm build`.
</div>

<!-- <snip id="starting-the-server-command-with-output" inject_from="yaml" template="sh"> -->
```sh
Expand Down Expand Up @@ -84,6 +90,11 @@ listening on port 5150

We have a base SaaS app with user authentication generated for us. Let's make it a blog backend by adding a `post` and a full CRUD API using `scaffold`:

<div class="infobox">

You can choose between generating an `api`, `html` or `htmx` scaffold using the required `-k` flag.
</div>

```sh
$ cargo loco generate scaffold post title:string content:text -k api

Expand Down Expand Up @@ -127,6 +138,14 @@ listening on port 5150
```
<!-- </snip> -->

<div class="infobox">

Depending on which `-k` option you chose, the steps for creating a scaffolded resource will change. With the `api` flag or the `htmx` flag you can use the below example. But with the `html` flag, it is recommended you do the post creation steps in your browser.

If you want to use `curl` to test the `html` scaffold, you will need to send your requests with the Content-Type `application/x-www-form-urlencoded` and the body as `title=Your+Title&content=Your+Content` by default. This can be changed to allow `application/json` as a `Content-Type` in the code if desired.

</div>

Next, try adding a `post` with `curl`:

```sh
Expand Down

0 comments on commit a5ce639

Please sign in to comment.