Getting started with aurelia

Download aurelia eBook

Remarks

Aurelia is a modular modern front-end Javascript framework for building browser, mobile and desktop applications built on open web standards. Rather than being an all inclusive framework, Aurelia adopts a feature-per-module approach to its architecture. Any piece of Aurelia is replaceable with a third-party dependency (or removed altogether).

Unlike competing frameworks such as Angular, Aurelia's core philosophy is to abide by official web standards and DOM API's, this ensures more bare-metal performance as it sits closer to native API's and has very little abstraction. Your views are HTML, your view-models are Javascript (or TypeScript) and Aurelia's component model is based on W3C Web Components HTML Templates and ShadowDOM, so your code mirrors that of a real emerging web standard.

Even though Aurelia is a fully-featured single page application framework, the learning curve is a lot lower than existing alternatives like Angular and Ember. Its templating syntax is intuitive and shares similarities with previous frameworks and libraries you might have worked with.

A developer or company might opt to use Aurelia over other solutions because standards matter to them and writing abstract framework-specific boilerplate code does not feel right to you and you're looking for a framework that prefers to let native DOM API's do the work for you.

Hello World: Getting started with aurelia-cli

This example will show you how to quickly get a hello world Aurelia application up and running using the Aurelia CLI.

Prerequisites

The Aurelia CLI is a Node.js based application, so make sure you install it first before proceeding. You will need Node.js 4.4.7 or later.

You will also need a Git client installed. Some great options include: Github Desktop, Sourcetree and Git SCM.

Installing the CLI

Provided you installed Node.js and Npm correctly, open up a Command Prompt/PowerShell or Bash terminal and install the CLI globally using the following command:

npm install aurelia-cli -g
 

Before proceeding, run au -v to make sure that the Aurelia CLI successfully installed. You should see a version number displayed.

Creating your first Aurelia application

Now you have the CLI installed, to create a new project run the following command and following the informative on screen prompts:

au new
 

You'll get a choice of different formats and loaders, to keep things simple just select the defaults. As you become more familiar with the CLI, you can configure these options to match your needs.

Running your Aurelia application

To run your Aurelia application, from the same folder run: au run - you should now see a fully-functioning hello world application when you open up your application in a web browser. By default, the CLI dev server will be available at http://localhost:9000

Conclusion

You have just successfully created a "hello world" Aurelia application using the CLI.

Stats

142 Contributors: 3
Thursday, July 13, 2017
Licensed under: CC-BY-SA

Not affiliated with Stack Overflow
Rip Tutorial: info@zzzprojects.com

Download eBook