Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Adrian Salceanu committed Dec 28, 2018
1 parent 1403080 commit 1c441ae
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@
Genie is a full-stack MVC web framework that provides a streamlined and efficient workflow for developing modern web applications. It builds on Julia's strengths (high-level, high-performance, dynamic, JIT compiled), exposing a rich API and a powerful toolset for productive web development.

### Current status
Genie is now compatible with Julia v1.0 (and it's the only version of Julia supported anymore).
This is a recent development (mid September 2018) so more testing is needed.
Genie is compatible with Julia v1.0 and up.

# Getting started

Expand Down Expand Up @@ -93,6 +92,31 @@ Now if we access http://localhost:8000/sum/2/3 we should see `5`

---

## Developing a simple REST API backend

Genie makes it very easy to quickly set up a REST API backend. All it takes is a few lines of code:

```julia
using Genie
import Genie.Router: route
import Genie.Renderer: json!

Genie.config.run_as_server = true

route("/") do
(:message => "Hi there!") |> json!
end

Genie.AppServer.startup()
```

The key bit here is `Genie.config.run_as_server = true`. This will start the server synchronously so the `startup()` function won't return. This endpoint can be run directly from the command line - if say, you save the code in a `rest.jl` file:
```bash
$ julia rest.jl
```

---

## Working with Genie apps (projects)

Working with Genie in an interactive environment can be useful – but usually we want to persist our application and reload it between sessions. One way to achieve that is to save it as an IJulia notebook and rerun the cells. However, you can get the most of Genie by working with Genie apps. A Genie app is an MVC web application which promotes the convention-over-configuration principle. Which means that by working with a few predefined files, within the Genie app structure, Genie can lift a lot of weight and massively improve development productivity. This includes automatic module loading and reloading, dedicated configuration files, logging, environments, code generators, and more.
Expand Down Expand Up @@ -739,7 +763,7 @@ end
```

#### Autoloading the DB configuration
Now, to try things out. Genie takes care of loading all our resource files for us when we load the app. Also, Genie comes with a special file called an initializer, which can automatically load the database configuration and setup SearchLight. Just edit "config/initializers/searchlight.jl" and uncomment the code. It should look like this:
Now, to try things out. Genie takes care of loading all our resource files for us when we load the app. Also, Genie comes with a special file called an initializer, which can automatically load the database configuration and setup SearchLight. Just edit "config/initializers/searchlight.jl" and uncomment the code. It should look like this:
```julia
using SearchLight, SearchLight.QueryBuilder

Expand Down

0 comments on commit 1c441ae

Please sign in to comment.