-
-
Notifications
You must be signed in to change notification settings - Fork 5
Run an application
gt serve starts the PHP development server, but in real applications there's more to running than just running a server.
gt run is the normal development command because it starts the local server and also takes care of the other background tasks a project may need, such as asset building and cron jobs. In a tiny project there may be no visible difference yet, but in a fuller application gt run usually gives the most accurate local setup.
Use gt serve when you only want to test the PHP page handling layer and do not need those supporting background processes. Use gt build separately when you want to compile or copy client-side assets without also starting the server.
When gt run starts, the public files served by the browser still come from www/, while page requests that are not static files are passed through WebEngine's go.php entry point.
That means two kinds of work are happening locally:
- ordinary static file serving from
www/ - dynamic page rendering through WebEngine
On top of that, the build system may be watching your asset source files, and the cron runner may be watching for scheduled tasks. Those jobs are not part of every project, but it is useful to understand early that "running the app" often means running more than one process.
Changing the port is usually a matter of passing the appropriate option to the server command or configuring it in the local toolchain. Restarting the app is often as simple as stopping gt run and starting it again.
When something is not working, first decide whether the problem is:
- a static asset issue, such as a CSS or JavaScript file not being built into
www/ - a page handling issue, such as a missing route, logic error, or configuration problem
That simple split often saves time when debugging.
Next, let's learn about the request-response lifecycle.
- File-based routing
- Page views
- Page logic
- Dynamic URIs
- Headers and footers
- Custom HTML components
- Page partials
- Binding data to the DOM
- DOM manipulation
- Hello You tutorial
- Todo list tutorial
- Address book tutorial WIP
- Blueprints
- Application architecture
- Coding styleguide WIP
- PHP environment setup WIP
- Web servers WIP
- Background cron tasks
- Database setup WIP
- Client-side compilation WIP
- Testing WebEngine applications WIP
- Production checklist WIP
- Security WIP