2015-12-04 11:26:15 +00:00
|
|
|
# Kemal Tutorial
|
|
|
|
|
|
|
|
## Install Crystal
|
|
|
|
|
|
|
|
```
|
|
|
|
brew update
|
|
|
|
brew install crystal-lang
|
|
|
|
```
|
|
|
|
|
|
|
|
## Installing Kemal
|
|
|
|
|
|
|
|
You should create your application first:
|
|
|
|
|
|
|
|
```
|
|
|
|
crystal init app awesome_web_project
|
|
|
|
cd awesome_web_project
|
|
|
|
```
|
|
|
|
|
|
|
|
Then add *kemal* to the `shard.yml` file as a dependency.
|
|
|
|
|
2015-12-04 11:36:06 +00:00
|
|
|
```yml
|
2015-12-04 11:26:15 +00:00
|
|
|
dependencies:
|
|
|
|
kemal:
|
|
|
|
github: sdogruyol/kemal
|
|
|
|
branch: master
|
|
|
|
```
|
|
|
|
|
|
|
|
You should run `shards` to get dependencies:
|
|
|
|
|
|
|
|
```
|
|
|
|
shards install
|
|
|
|
```
|
|
|
|
|
|
|
|
## Include Kemal into your project
|
|
|
|
|
|
|
|
Open `awesome_web_project/src/awesome_web_project.cr` and require `kemal` to use Kemal.
|
|
|
|
|
2015-12-04 11:36:06 +00:00
|
|
|
```ruby
|
2015-12-04 11:26:15 +00:00
|
|
|
require 'kemal'
|
|
|
|
```
|
|
|
|
|
|
|
|
## Hack your project
|
|
|
|
|
|
|
|
Do some awesome stuff with awesome Kemal.
|
|
|
|
|
2015-12-04 11:36:06 +00:00
|
|
|
```ruby
|
2015-12-04 11:26:15 +00:00
|
|
|
get "/" do
|
|
|
|
"Hello World!"
|
|
|
|
end
|
|
|
|
```
|
|
|
|
|
|
|
|
## Run your awesome web project.
|
|
|
|
|
|
|
|
```
|
|
|
|
crystal build --release src/awesome_web_project.cr
|
|
|
|
./awesome_web_project
|
|
|
|
```
|
|
|
|
|
|
|
|
Now you can be happy with your new, very fast, readable web project.
|