Creating Hello World web application With Fano CLI
In this step by step tutorial, we are going to create a simple CGI web application which displays greeting message using Fano CLI. Read Scaffolding with Fano CLI for more information.
Who is this tutorial for?
This tutorial is written for anyone new to Fano Framework. It is assumed that you have proficiency with Free Pascal and its language syntax. You are familiar with Linux command and and its shell terminal.
- Free Pascal >= 3.0
- Apache 2.4
- Text editor, vim, VSCode, Atom etc.
- Fano CLI
- Working Internet connection.
- Root privilege.
Make sure that all requirements are met. To create a CGI project, run
$ fanocli --project=Hello
Wait until new project is created. If everything is ok, your project will be created inside
Hello directory. Change active directory to
$ cd Hello
All actions below is assumed to take place inside
Wait until compilation is finished.
Setup web server configuration
$ sudo fanocli --deploy-cgi=hello.fano
Access application from browser
Open web browser and go to
http://hello.fano. You should see Fano Application Error page. It is normal as you have not create any route to handle the request.
Create a controller
$ fanocli --controller=Home
Command above will create
src/App/Home/Controllers directory and register route
/home so you will be able to access it via URL
Rebuild application by running,
After compilation is finished, open web browser and go to
http://hello.fano/home. You should see text
Home controller printed. Congratulations, your application is working.
Creating default route
However, if you open,
http://hello.fano, you will still get Fano Application Error page. To fix it, you need to add route to
With your favorite text editor, open
src/Routes/routes.inc file and add following line.
router.get('/', container.get('homeController') as IRequestHandler);
With web browser, go ahead and open
http://hello.fano. Fano Application Error page is disappeared.
In this tutorial, you have learned how to use Fano CLI to
- Setup web application project directory with Fano Framework,
- Deploy application with Apache web server,
- Create controller,
- Create default route.