Skip to content
This repository was archived by the owner on Dec 13, 2018. It is now read-only.
This repository was archived by the owner on Dec 13, 2018. It is now read-only.

Auto-expand application customData #440

@edjiang

Description

@edjiang

In my latest blog post about Stormpath on HyperDev, I had to write sample code that looks like this:

app.get('/global-counter', function(req, res) {
  req.app.get('stormpathApplication').getCustomData(function(err, customData) {
    if(!customData) {
      return res.status(500).send("Internal Server Error")
    }
    if(typeof customData.visitCount != "number") {
      customData.visitCount = 1
    }
    res.send("People have visited this page " + customData.visitCount + " times!")
    customData.visitCount = customData.visitCount + 1
    customData.save()
  })
})

I think it makes sense for the {expand: "customData"} config option to also add customData to stormpathApplication, so I only have to do:

req.app.get('stormpathApplication').customData

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions