Hello World
This tutorial will show you how to add a basic page to your THT app.
Setup
We assume you have set up the starter app.
Page URLs
To create a new page, just add a .tht
file to the code/pages
directory.
The filename must be all lower-case separated by dashes.
Each page file automatically gets a clean URL that matches the filename.
For example:
File | URL |
---|---|
code/pages/my-blog.tht | /my-blog |
code/pages/help/contact-us.tht | /help/contact-us |
code/pages/event-calendar/this-weekend.tht | /event-calendar/this-weekend |
Step 1: Create the Page
Create a new file with this line of code:
print('Hello World!')
Then save the file as:
code/pages/hello-world.tht
Step 2: Load the Page
Load this URL: http://localhost:3333/hello-world
Here’s what you should see:
Hello World!