Create a New App
Setup
We assume you have installed THT.
Step 1: Create the Starter App
Run tht new myApp
. (Change “myApp” to whatever you like.)
$ tht new myApp
Here’s what you’ll see before you confirm (example):
----------------- NEW APP ----------------- - App name: myApp > Create new THT app in current directory? (y/N)? y
Starter App Files
You will now have a myApp
directory with these sub-directories:
Directory | Description |
---|---|
code |
Your app source code (.tht files) |
config |
Configuration files (.jcon files) |
data |
Logs, database files, cache files, etc. |
public |
Static files. Images, CSS, JS, etc. (i.e. the Document Root) |
These directories contain a basic starter app that you can build on.
Step 2: Run the App
Time to try it out!
Go to your app folder.
$ cd myApp
Run this command to start the local test server:
$ tht server
Here’s what you’ll see:
--------------------- TEST SERVER --------------------- - App: myApp - URL: http://localhost:3333 > 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:3333
Here’s what you should see:
App Ready
This app is ready for development.