Getting started with aah framework

It is easy to start and work with aah framework. Let’s make sure you have Go environment ready.

Here you will be learning:

Installing aah framework and CLI tool

Execute below go get on your terminal/command prompt. Since v0.7 aah CLI is revamped and POSIX flags (short & long) for commands. Also commands has alias too.

Note: aah framework requires ≥ go1.8

go get -u aahframework.org/tools.v0/aah

Verify your aah installation

Just execute aah command on your terminal/command prompt. Learn more about aah CLI.

aah

Output: (you will get similar output)

jeeva@mb-pro:~$ aah
‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           aah framework v0.10 - https://aahframework.org
____________________________________________________________________
# Report improvements/bugs at https://github.com/go-aah/aah/issues #

Usage:
  aah [global options] command [command options] [arguments...]

Commands:
  new, n          Create new aah 'web' or 'api' application (interactive)
  run, r          Run aah framework application (supports hot-reload)
  build, b        Build aah application for deployment
  list, l         List all aah projects in GOPATH
  clean, c        Cleans the aah generated files and build directory
  switch, s       Switch between aah release and edge version
  update, u       Update your aah to the latest release version on your GOPATH
  generate, g     Generates boilerplate code, configurations, complement scripts (systemd, docker), etc.
  help, h         Shows a list of commands or help for one command

Global Options:
  -h, --help     show help
  -v, --version  print aah framework version and go version

Congratulations, you have successfully installed aah framework and it’s ready to use :).

Let’s create your first aah application

It is very easy to use aah framework CLI tool. Learn more about aah CLI tool.

# `new` command, alias `n` - is an interactive one to create aah application for quick start
aah new

Output:

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           aah framework v0.10 -  https://aahframework.org
____________________________________________________________________
# Report improvements/bugs at https://github.com/go-aah/aah/issues #


Welcome to interactive way to create your aah application, press ^C to exit :)

Based on your inputs, aah CLI tool generates the aah application structure for you.

Enter your application import path: github.com/jeevatkm/aah-first-app

Choose your application type (web or api), default is 'web':

Choose your application View Engine (go, pug), default is 'go':

Choose your application Auth Scheme (form, basic), default is 'none':

Your aah web application was created successfully at '/Users/jeeva/go/src/github.com/jeevatkm/aah-first-app'
You shall run your application via the command: 'aah run --importpath github.com/jeevatkm/aah-first-app'


Go to https://docs.aahframework.org to learn more and customize your aah application.

Run your aah application

aah run --importpath github.com/jeevatkm/aah-first-app

# OR
aah run -i github.com/jeevatkm/aah-first-app

# OR
cd $GOPATH/src/github.com/jeevatkm/aah-first-app
aah run

# OR
aah r

Output:

‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾
           aah framework v0.10 -  https://aahframework.org
____________________________________________________________________
# Report improvements/bugs at https://github.com/go-aah/aah/issues #

Loaded aah project file: /Users/jeeva/go/src/github.com/jeevatkm/aah-first-app/aah.project
Hot-Reload enabled for environment profile: dev
Compile starts for 'aah-first-app' [github.com/jeevatkm/aah-first-app]
Compile successful for 'aah-first-app' [github.com/jeevatkm/aah-first-app]
2018-03-18 22:03:26.111 INFO  aah framework v0.10, requires ≥ go1.8
2018-03-18 22:03:26.114 DEBUG Event [OnInit] publishing in synchronous mode
2018-03-18 22:03:26.126 INFO  aah-first-app aah application initialized successfully
2018-03-18 22:03:26.126 INFO  aah-first-app App Name: aah-first-app
2018-03-18 22:03:26.126 INFO  aah-first-app App Version: 0.0.1
2018-03-18 22:03:26.126 INFO  aah-first-app App Build Date: 2018-03-18T22:03:24-07:00
2018-03-18 22:03:26.126 INFO  aah-first-app App Profile: dev
2018-03-18 22:03:26.126 INFO  aah-first-app App TLS/SSL Enabled: false
2018-03-18 22:03:26.126 INFO  aah-first-app App View Engine: go
2018-03-18 22:03:26.126 INFO  aah-first-app App Session Mode: stateless
2018-03-18 22:03:26.126 INFO  aah-first-app App Anti-CSRF Protection Enabled: true
2018-03-18 22:03:26.126 INFO  aah-first-app aah go server running on :8080

Open up your browser, navigate to address http://localhost:8080 to see you first aah application in action.

You will see a page with text:

Welcome to aah framework - Web Application

Learning aah project structure

Learn more about aah project structure, it is one of the important start point.

Next move onto application configuration

Learn more about aah application configuration and customize your application.