From aa70e72192102ed24bac2468cb0a1e600b02034b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fatih=20Kadir=20Ak=C4=B1n?= Date: Sat, 5 Dec 2015 13:52:07 +0200 Subject: [PATCH] Update tutorial.md --- docs/tutorial.md | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/docs/tutorial.md b/docs/tutorial.md index e581a6a..3df4e1c 100644 --- a/docs/tutorial.md +++ b/docs/tutorial.md @@ -1,13 +1,13 @@ # Kemal Tutorial -## Install Crystal +## 1. Install Crystal ``` brew update brew install crystal-lang ``` -## Installing Kemal +## 2. Installing Kemal You should create your application first: @@ -31,7 +31,15 @@ You should run `shards` to get dependencies: shards install ``` -## Include Kemal into your project +It will output something like that: + +``` +$ shards install +Updating https://github.com/sdogruyol/kemal.git +Installing kemal (master) +``` + +## 3. Include Kemal into your project Open `awesome_web_project/src/awesome_web_project.cr` and require `kemal` to use Kemal. @@ -39,7 +47,7 @@ Open `awesome_web_project/src/awesome_web_project.cr` and require `kemal` to use require 'kemal' ``` -## Hack your project +## 4. Hack your project Do some awesome stuff with awesome Kemal. @@ -49,11 +57,32 @@ get "/" do end ``` -## Run your awesome web project. +All the code should look like this: + +```ruby +require "./crystal_test/*" +require "kemal" + +module AwesomeWebProject + get "/" do + "Hello World!" + end +end +``` + +## 5. Run your awesome web project. ``` crystal build --release src/awesome_web_project.cr ./awesome_web_project ``` +You should see some logs like these: + +``` +[development] Kemal is ready to lead at http://0.0.0.0:3000 +2015-12-01 13:47:48 +0200 | 200 | GET / - (666µs) +2015-12-05 13:47:48 +0200 | 404 | GET /favicon.ico - (14µs) +``` + Now you can be happy with your new, very fast, readable web project.