Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow access to resources from within the app code (Business Logic?) #1

Open
alonronin opened this issue Mar 25, 2012 · 1 comment
Open

Comments

@alonronin
Copy link
Contributor

add resources instances to the app.

@airtonix
Copy link

# ./app.coffee

_ = require 'lodash'
app = require 'express'
jest = require 'jest'
includeAll = require 'include-all'

app.set 'api roots', ['/api/v1/', 'api/v2']

app.api = new jest.Api app.get('api roots')[0], app

app.resources = includeAll
  dirname: "#{__dirname}/resources"
  filter: /(.+Resource).js$/

_.each resources, (resource, name) ->
  app.resources[name] = new resource(app)
#./resources/UserResource.coffee

jest = require 'jest'

modue.exports = (app) ->
  return jest.Resource.extend
    init: () ->
      @_super app.models.UserModel0
      # ... blah

refack pushed a commit that referenced this issue Jun 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants