rzr core module
CoffeeScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
domain
README.md

README.md

rzr

(razor) is a razor-thin functional application framework

Core Components

rzr consists of 3 core components: Services, Models and Agents

Services are the verbs in your stories- the actions that happen.

login = Service ->
  @in 
    user: X @User
  @out
    user: @find @user
    token: generateToken()

**Models** are the _nouns_ in your stories- the _things_ that are important
User = Model
  name: @string.length.min.3
  password: @password.min.12

**Agents** expose Models and Services, and communicate with other Agents
UserAgent = Agent ->
  @collab SomeOtherAgent
  @expose login, User

Modules

a Module is a collection of related Models and Services (and their specs), with one Agent governing the Module.
Modules can be nested within other Modules with arbitrary depth, with a folder within your /projectRoot/domain/ directory representing a module

Specs

Specs are executable specifications that specify some behavior that needs to be fulfilled and every service has at least one Spec. Spec support is provided by the Spex framework

Control Structures

series

run Services in series

series
  delay
    timeout: 5
    cb: -> console.log "5"
  delay
    timeout: 2
    cb: -> console.log "2"

# 5
# 2

chain

run Services in series, passing output of one to the next

chain
  login
    user: user  
  handleLogin