Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/obsidian/orion
A Crystal router
https://github.com/obsidian/orion
crystal crystal-language router
Last synced: 7 days ago
JSON representation
A Crystal router
- Host: GitHub
- URL: https://github.com/obsidian/orion
- Owner: obsidian
- License: mit
- Created: 2017-08-30T06:52:01.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-04-05T23:24:40.000Z (over 2 years ago)
- Last Synced: 2024-10-25T01:23:15.971Z (15 days ago)
- Topics: crystal, crystal-language, router
- Language: Crystal
- Homepage: https://obsidian.github.io/orion
- Size: 525 KB
- Stars: 123
- Watchers: 6
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-crystal - orion - A minimal, rails-esque routing library (Routing)
- awesome-crystal - orion - A minimal, rails-esque routing library (Routing)
- awesome-crystal - orion - A minimal, rails-esque routing library (Routing)
README
![Orion](https://raw.githubusercontent.com/obsidian/orion/v3.0.0-dev/orion-banner.svg)
[![Crystal CI](https://github.com/obsidian/orion/workflows/Crystal%20CI/badge.svg)](https://github.com/obsidian/orion/actions?query=workflow%3A%22Crystal+CI%22)
[![GitHub issues](https://img.shields.io/github/issues/obsidian/orion)](https://github.com/obsidian/orion/issues)
[![GitHub stars](https://img.shields.io/github/stars/obsidian/orion)](https://github.com/obsidian/orion/stargazers)
[![GitHub license](https://img.shields.io/github/license/obsidian/orion)](https://github.com/obsidian/orion/blob/master/LICENSE)
[![Documentation](https://img.shields.io/badge/Read-Documentation-%232E1052)](https://obsidian.github.io/orion)---
## 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.```crystal
require "orion/app"root do
"Welcome Home"
endget "/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.```crystal
require "orion/app"
require "auth_handlers"static "/", dir: "./assets"
scope "/api" do
use AuthHandlers::Token
enduse AuthHandlers::CookieSession
scope constraint: UnauthenticatedUser do
root do
render "views/home.slim"
endget "/login", helper: login do
render "views/login.slim"
endpost "/login" do
if User.authenticate(params["email"], params["password"])
redirect to: root_path
else
flash[:error] = "Invalid login"
redirect to: login_path
end
endscope constraint: AuthenticatedUser do
root do
render "views/dashboard.slim"
end
end
```## Installation
Add this to your application's shard.yml:```yml
dependencies:
orion:
github: obsidian/orion
```See also [Getting Started](https://github.com/obsidian/orion/wiki/Getting-Started).
## Documentation
View the docs at [https://obsidian.github.io/orion](https://obsidian.github.io/orion).
View the guides at [https://github.com/obsidian/orion/wiki](https://github.com/obsidian/orion/wiki).