Skip to content
dashkb edited this page Jul 18, 2012 · 21 revisions

Welcome to the Dzl wiki! Here lies documentation of the DSL.

Filling up on Dzl

Dzl needs you to set your application's root path before including the module.

Including the Dzl module in YourAwesomeAPI will do three things you care about:

  • YourAwesomeAPI becomes a rack application
  • YourAwesomeAPI gets extended with the DSL
  • YourAwesomeAPI.logger is set to a Dzl::Logger configured to write to the /log directory under YourAwesomeAPI.root (unless you had already defined it, in which case Dzl leaves it alone)
# config.ru
class YourAwesomeAPI
  # In 1.0.3 this will not be necessary; Dzl will define it for you (assuming the directory 
  # containing your gemfile) unless you have defined it yourself.
  def self.root; File.expand_path('../', __FILE__); end
  include Dzl
end

run YourAwesomeAPI

In development, Dzl will reset your application and reload all code under [App root]/lib if you change a file.

Dzl is happy to parse and validate JSON request bodies. Be sure to set the Content-Type header to application/json.

Endpoints

Parameter Blocks

Scopes

Parameters & Validations

Hash Parameter Validation

Handlers

Defaults

Why do I have to use one giant file for my API?

Clone this wiki locally