mirror of
https://gitea.invidious.io/iv-org/shard-kemal.git
synced 2024-08-15 00:53:36 +00:00
Create tutorial.md
This commit is contained in:
parent
17ff97307d
commit
880d2c1430
1 changed files with 59 additions and 0 deletions
59
docs/tutorial.md
Normal file
59
docs/tutorial.md
Normal file
|
@ -0,0 +1,59 @@
|
|||
# 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.
|
||||
|
||||
```
|
||||
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.
|
||||
|
||||
```
|
||||
require 'kemal'
|
||||
```
|
||||
|
||||
## Hack your project
|
||||
|
||||
Do some awesome stuff with awesome Kemal.
|
||||
|
||||
```
|
||||
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.
|
Loading…
Reference in a new issue