Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

@all for Express #40

Closed
Radagaisus opened this Issue · 9 comments

5 participants

@Radagaisus
@app.all '/api/v1/user/current/*', (req, res, next) ->
    if req.user then next()
    else res.end()

Just noticed there's no @all function. Should I write a pull request or is that intentional?

@shimaore
Owner

I always thought it was intentional.
FWIW I just looked at the Express 3.x doc and in the root (application) scope Zappa doesn't offer @app.(all|locals|render|routes).
What do others think about adding @all?

@shimaore shimaore referenced this issue from a commit
@shimaore shimaore Added links to Express References.
Triggered by #40 :)
2ec1394
@scien
Owner

+1 for adding @all

@shimaore shimaore referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
@shimaore shimaore referenced this issue from a commit
@shimaore shimaore Added `@all` (#40) 998ba8e
@Radagaisus

Looks good. What about @param for app.param?

@Radagaisus

Example:

# Check if the user_id is a valid MongoDB ID
@param 'user_id', (req, res, next, user_id) ->
  if ~user_id.indexOf /^[0-9A-F]{24,24}$/i
    next("Invalid User ID")
  next()
@shimaore
Owner

@Radagaisus please test @param (see documentation above)

@Radagaisus

@shimaore I can't right now, I'm working with an older version of Zappa. I'll write tests in the weekend.

@Radagaisus

Hey, I've added all the tests here. There's no need to test different HTTP methods, just different routes. If you want another test for different HTTP methods I'll add it.

@rchunduru

When it is going to be available with npm?

@datashaman datashaman referenced this issue from a commit in datashaman/zappajs
@datashaman datashaman Add test for all from Radagaisus #40 55a088d
@datashaman

This can be closed.

@shimaore shimaore closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.