NYCrb / devpunks

http://devPunks.com modern development site for podcast & youtube videos
MIT License
15 stars 1 forks source link

devpunks

DSL (Domain Specific Language) for (config.ru)

Configuration Helpers (helpers.rb) Inspired by Express.js (http://expressjs.com/) routing.

static!

Expose static files (defaults to ./public)

static!

route

Define handler for route URI

route ('/foo') { 'devPunks' }

run!

Run the Application

run!

four_oh_four!

Fallback error page for missing route definitions.

four_oh_four! # /not-found => 404 & renders ./public/404.html

Action Methods (action.rb)

params

Access to (GET, POST, PUT, & PATCH) request parameters

route ('/echo?value=Hello') { "#{params[:value]} World!" }

status

Get or set the response code.

status 201 #=> Responds with 201 CREATED

Install

$ bundle

Running Server

Development

$ bundle exec shotgun

Production

$ rackup

Dependencies

Development

Skeleton Framework: or...Why Rack?

https://news.ycombinator.com/item?id=4517021

Web Servers vs. App Servers http://www.justinweiss.com/articles/a-web-server-vs-an-app-server/

Rails vs. Sinatra https://blog.engineyard.com/2014/rails-vs-sinatra

How Does Rack Work? https://blog.engineyard.com/2015/understanding-rack-apps-and-middleware

Standalone ActiveRecord[5.0] http://blog.bigbinary.com/2015/12/28/application-record-in-rails-5.html