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.

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

Note: git config is no longer required, it has been handled in aah go get service. If you get an error during aah installation, please report it.

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.9 -  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 (beta)
  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.9 -  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 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.9 -  https://aahframework.org
____________________________________________________________________
# Report improvements/bugs at https://github.com/go-aah/aah/issues #

2017-09-27 22:25:49.463 INFO  Loading aah project file: /Users/jeeva/go/src/github.com/jeevatkm/aah-first-app/aah.project
2017-09-27 22:25:49.464 INFO  Hot-Reload enabled for environment profile: dev
2017-09-27 22:25:49.464 INFO  Compile starts for 'aah-first-app' [github.com/jeevatkm/aah-first-app]
2017-09-27 22:25:50.894 INFO  Compile successful for 'aah-first-app' [github.com/jeevatkm/aah-first-app]
2017-09-27 22:25:50.963 INFO  aah framework v0.9, requires ≥ go1.8
2017-09-27 22:25:50.969 INFO  aah application initialized successfully
2017-09-27 22:25:50.969 INFO  aah-first-app App Name: aah-first-app
2017-09-27 22:25:50.969 INFO  aah-first-app App Version: 0.0.1
2017-09-27 22:25:50.969 INFO  aah-first-app App Build Date: 2017-09-27T22:25:49-07:00
2017-09-27 22:25:50.969 INFO  aah-first-app App Profile: dev
2017-09-27 22:25:50.969 INFO  aah-first-app App TLS/SSL Enabled: false
2017-09-27 22:25:50.969 INFO  aah-first-app App Session Mode: stateless
2017-09-27 22:25:50.969 INFO  aah-first-app App Anti-CSRF Protection Enabled: true
2017-09-27 22:25:50.969 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.

  Need Help?

  •   Chat on Gitter
  •   Github Issues
  •   Ask on StackOverflow - tag aahframework