orion

A minimal, rails-esque routing library router
3.1.0 Latest release released
obsidian/orion
122 8 3
Obsidian Crystal

Orion

Crystal CI GitHub issues GitHub stars GitHub license Documentation


Introduction

Orion is minimal, Omni-Conventional, declarative web framework inspired by the ruby-on-rails router and controller components. It provides, the routing, view, and controller framework of your application in a way that can be as simple or complex as you need it to fit your use case.

Simple Example

Orion out of the box is designed to be as simple as you want it to be. A few lines will get you a functioning web app. Orion also ships with helpful features such as view rendering and static content delivery.

require "orion/app"

root do
  "Welcome Home"
end

get "/posts" do
  "Many posts here!"
end

Flexible Routing

Orion is extemely flexible, it is inspiried by the rails routing and controller framework and therefore has support for scope, concerns, use HTTP::Handler, constraints and more! See the modules in Orion::DSL more more detail.

require "orion/app"
require "auth_handlers"

static "/", dir: "./assets"

scope "/api" do
  use AuthHandlers::Token
end

use AuthHandlers::CookieSession

scope constraint: UnauthenticatedUser do
  root do
  render "views/home.slim"
end

get "/login", helper: login do
  render "views/login.slim"
end

post "/login" do
  if User.authenticate(params["email"], params["password"])
    redirect to: root_path
  else
    flash[:error] = "Invalid login"
    redirect to: login_path
  end
end

scope constraint: AuthenticatedUser do
  root do
    render "views/dashboard.slim"
  end
end

Installation

Add this to your application's shard.yml:

dependencies:
  orion:
    github: obsidian/orion

See also Getting Started.

Documentatation

View the docs at https://obsidian.github.io/orion. View the guides at https://github.com/obsidian/orion/wiki.

orion:
  github: obsidian/orion
  version: ~> 3.1.0
License MIT
Crystal ~> 1.0

Authors

Dependencies 4

  • exception_page
    {'github' => 'crystal-loot/exception_page'}
  • inflector ~> 1.0.0
    {'github' => 'phoffer/inflector.cr', 'version' => '~> 1.0.0'}
  • kilt
    {'github' => 'jeromegn/kilt'}
  • oak ~> 4.0.1
    {'github' => 'obsidian/oak', 'version' => '~> 4.0.1'}

Development Dependencies 0

Dependents 1

Last synced .
search fire star recently