Skip to content

Getting Started

Ravi Teja Gudapati edited this page Jun 18, 2017 · 8 revisions

In this tutorial, we will

  1. use jaguar cli to clone a boilerplate repository
  2. Examine the boilerplate example
  3. Test run the boilerplate example

Installation

jaguar cli has some nifty commands to clone boilerplate projects and assist in code generation. Install it using the following command:

pub global activate jaguar_cli

List available boilerplate/examples

list::projects command of jaguar cli lists all available boilerplate/examples.

jaguar list::projects

... boilerplate_reflect: Boilerplate for jaguar_reflect ...

In this example, we will be using boilerplate_reflect. Since it uses, source generation instead of reflection, it is much easier to get started.

Clone the project

Lets use create::project command of jaguar cli to clone the desired boilerplate.

jaguar create::project -r boilerplate_reflect

pub get

Lets resolve all pub dependencies.

pub get

Examine the example

You might want to peek at the following files:

  1. lib/api.dart Declares the routes and route handlers
  2. bin/server.dart Main file for server
  3. bin/client.dart Main file for client. dart:io based client to test run the sample routes.

Test run

Run the server:

dart bin/server.dart

Run the client:

dart bin/client.dart

The client prints the response it received from the server on the terminal. It must be something similar to this:

=========================
body:
0.1
statusCode:
200
headers:
x-frame-options: SAMEORIGIN
content-type: text/plain; charset=utf-8
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
transfer-encoding: chunked

cookies:
[]

=========================
body:
{"name":"jaguar","motto":"Speed. Simplicity. Extensiblity.","degree of awesomeness":"infinity!"}
statusCode:
200
headers:
x-frame-options: SAMEORIGIN
content-type: application/json; charset=utf-8
x-xss-protection: 1; mode=block
x-content-type-options: nosniff
transfer-encoding: chunked

cookies:
[]

Where to go from here

IDE

We recommend installing IntelliJ IDE and Dart plugin for IntelliJ IDE. We believe IntelliJ is the best IDE available for Dart. It makes developing Jaguar.dart applications a breeze.

Alternatively, atom.io with dart plugin is also a good editor.

Digging deeper into Jaguar.dart

Jaguar.dart wiki has several articles on introduction to various parts of Jaguar framework.

asciicast

Basics

Serialization

Forms

Sessions

Authentication

  • Basic authentication
  • Form authentication
  • JSON authentication
  • Authorization
  • OAuth

Database

Security

Real time

  • Server sent events (SSE)
  • Websockets

Deployment

  • systemd
  • Docker
  • AppEngine

API Documentation

Clone this wiki locally