Rullst AcademyRullst Academy/Lesson
Applications with Rullst I · Lesson 03 / 14

Routes: an address and an intention

The same path can receive read and create requests.

Learning paths16 min

Let's discover together

  1. 1

    A request combines method, path, headers and sometimes a body. In src/routes.rs, GET /api/missions calls list and POST on that path calls create. The router chooses the handler; the handler applies rules and produces the response.

  2. 2

    The root / serves HTML; /app.js and /style.css serve files embedded at compile time. /api/missions returns database JSON. There is no api/missions folder: a route is an access contract, not necessarily a disk file.

  3. 3

    Open /healthz and /api/missions in the browser. Check status and Content-Type in the developer tools Network tab. /healthz confirms the process responds; it is not a complete persistence test. GET should read without creating missions.

  4. 4

    Stop the server, add GET /about-lab with a short response and run again. include_str! embeds files; HTML, JS and CSS changes also need rebuilding. The kit does not include automatic reload.

Your application workbench

The kit includes a complete app to investigate and modify. The excerpt below explains this step; the editor contains the indicated file. Rullst Academy does not compile or run this server in your browser.

File to study and modify

src/routes.rs

.route("/api/missions", get(list).post(create))
.route("/healthz", get(health))

Extract the kit to a new folder and open a terminal beside Cargo.toml. Use Rust 1.96+; the first build may download dependencies and take time. Then open http://127.0.0.1:3010. Stop with Ctrl+C and run again after editing.

cargo test --locked
cargo run --locked
My files and GitHub

Download your draft and replace the indicated file in your extracted copy. The editor saves one file in this browser; your account saves assessments and XP. The ZIP excludes your edits. GitHub sends only the confirmed file; use Git manually for the whole app, excluding databases, backups and secrets.

Official links and next step

✦
YOUR MISSION

Relate method, path, handler and response without confusing a route with a file.

Now it's your turn

Discovery workshop

Decide before running

Relate method, path, handler and response without confusing a route with a file.
Build your answers and check when you are ready.
A moment to understand

What does /api/missions represent?

I need a hint

The router associates method and path with a function. A route does not require a file with that name.

Loading your journey…

Take it with you

Draw the path of a read and a create. Add the introduction route and confirm that opening it three times does not change the list.

At your own pace

My files and GitHub

Every lesson can become your own record: code, notes or a practice plan. Saving a file to GitHub is optional and does not change your XP.

Student guide

The editor and downloads open when this lesson is available to your account. Check access below or return to the track map.

Checking your access to this lesson…

Rullstpetbot

AI can make mistakes. Check the lesson material.