Version: v0.6.1 - Beta.  We welcome contributors & feedback.  THanks!

Create a New App

Welcome 

We assume you have installed THT.

This tutorial will show you the steps to create a new app.

We will use myApp as the app name, but you can name it whatever you like.

Step 1: Create the App Directory 

Let’s create two directories:

This command will create both directories.

$ mkdir -p myApp/public

Step 2: Create the Starter App 

Go to the public subfolder.

Then run tht new.

$ cd myApp/public

$ tht new

Here’s what you’ll see before you confirm (example):

+-------------------+
|      NEW APP      |
+-------------------+

Your Document Root is:
  /Users/yourname/myApp/public

Is this correct? (y/N)? y

Step 3: Load the App 

The above command created a folder myApp/app which contains a starter app that you can build on.

It also added a couple of files to myApp/public which route incoming requests to the THT app.

SecurityYour app files are hosted outside of the public directory to prevent anyone from viewing your THT code as plain text in a browser.

Start the Test Server

While you are still inside the public folder, run this command to start the local test server:

$ tht server

Here’s what you’ll see:

+-------------------+
|    TEST SERVER    |
+-------------------+

App directory:
  /Users/yourname/myApp

Serving app at:
  http://localhost:8888

Press [Ctrl-C] to stop.

NoteThe built-in test server is great for development, but you will need to use a full web server, like Apache, to host the final app. More on that later.

Load the App!

Now load this URL in your web browser: http://localhost:8888

Here’s what you should see:

App Ready

This app is ready for development.