0.0.3 • Published 10 years ago

appstax-express v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

Appstax middleware for express.js

  • Forwards the "x-appstax-sessionid" header to calls using the appstax-js sdk.
  • Sets the neccesary CORS headers for using the appstax sdk on the client side.

Installing

> npm install appstax-express --save

Example usage

You initialize appstax with your app key as usual, and add use appstax.sessions() and appstax.cors() to apply the neccesary middleware.

var express = require("express");
var appstax = require("appstax-express");

var app = express();

appstax.init("your-app-key");
app.use(appstax.sessions());
app.use(appstax.cors("mydomain.appstax.io"));

app.get("/api/mydata", function(req, res) {

  // calls to appstax sdk methods will have the correct session id
  appstax.findAll("messages").then(function(messages) {
    // returns objects where the requesting session has read access
  })

});
0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago