Best viewed on desktop Mobile Friendly tutorial coming soon!

Your First Routes

Every lesson so far ran inside an app you never had to configure — that app is marko-run, and this part finally opens it up. The deal: files in src/routes/ become URLs. No route table, no config; a +page.marko file establishes a GET route at its directory’s path:

src/routes/
+page.marko → /
about/
+page.marko → /about

The + prefix is how marko-run recognizes routable files among your other modules — everything you learned in parts one through four (tags, styles, state) works unchanged inside them; a page is just a component that answers a URL.

The site on the right has a home page whose nav links to /about — currently a 404:

  1. Create the folder src/routes/about and inside it the file +page.marko.
  2. Give it a full page: heading “About us”, a paragraph, and an <a href="/">Home</a> link back.
  3. Click between the two pages. Two files, two URLs, zero configuration — and notice each navigation is a full page load; these are real server-rendered pages.
Powered by WebContainers Built with TutorialKit Built with ❤️ by defunkt-dev
Files
Preparing Environment
  • Installing dependencies
  • Starting dev server