Skip to content
This repository was archived by the owner on Oct 28, 2020. It is now read-only.

jonathantsao/Senro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Senro

Senro is a Ruby Controller and Views framework that uses a Postgresql database. Senro was inspired by Ruby on Rails. The word "Senro" is a japanese term for "train line".

Key Features

SenroController

Controllers that inherit from SenroController have the following methods:

  • render(template_name): renders a template within the views folder with the corresponding controller name.
  • render_content(content, content_type): renders using a custom content type.
  • redirect_to(url): redirects to the specified url.
  • session: accesses the session hash containing the session cookie.
  • flash and flash.now: accesses the hash containing errors that persist through the next session and the current session, respectively.

You can also add protect_from_forgery to your custom controllers to protect from CSRF attacks. Add the following input tag to your form:

  <input type="hidden"
  name="authenticity_token"
  value="<%= form_authenticity_token %>">

Then, by having protect_from_forgery in your custom controllers, Senro will check for the above authenticity token.

Router

The Router can be used to map routes between the controllers and the views.

router = Router.new
router.draw do
  get Regexp.new("^/movies$"), MoviesController, :index
  post Regexp.new("^/movies$"), MoviesController, :create
  get Regexp.new("^/movies/(?<movie_id>\\d+)/Actors$"), ActorsController, :index
end

Added Rack Middleware

  • Exceptions were added to provide a detailed description of the Ruby source error. This was intended to provide information to developers in the development environment.

  • Static were added to allow for the rendering of a static asset from the /public folder. Currently, .jpg, .png, .htm, .html, .txt, and .zip extensions are supported.

How to run Example App

  1. Make sure Ruby is up-to-date
  2. git clone https://www.github.com/jonathantsao/senro.git
  3. cd Senro
  4. bundle install
  5. ruby foods.rb
  6. Go to http://localhost:3000

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published