Skip to content

Instantly share code, notes, and snippets.

@fabiocav
Last active February 11, 2016 05:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fabiocav/e2c66433186838a0f2d5 to your computer and use it in GitHub Desktop.
Save fabiocav/e2c66433186838a0f2d5 to your computer and use it in GitHub Desktop.
module.exports = {
//"read": function (req, res, next) {
//}
}
{
"get": {
"access": "anonymous|authenticated|disabled"
},
"post": {
"access": "anonymous|authenticated|disabled"
},
"put": {
"access": "anonymous|authenticated|disabled"
},
"patch": {
"access": "anonymous|authenticated|disabled"
},
"delete": {
"access": "anonymous|authenticated|disabled"
}
}
var table = module.exports = require('azure-mobile-apps').table();
// table.read(function (context) {
// return context.execute();
// });
// table.read.use(customMiddleware, table.operation);
{
"autoIncrement": false,
"read": {
"access": "anonymous|authenticated|disabled"
},
"insert": {
"access": "anonymous|authenticated|disabled"
},
"update": {
"access": "anonymous|authenticated|disabled"
},
"delete": {
"access": "anonymous|authenticated|disabled"
},
"undelete": {
"access": "anonymous|authenticated|disabled"
}
}
@danderson00
Copy link

table.json:

{
  "authorize": false,
  "autoIncrement": false,
  "schema": "dbo",
  "read": {
    "access": "anonymous/authenticated/disabled"
  },
  "insert": {
    "access": "anonymous/authenticated/disabled"
  },
  "update": {
    "access": "anonymous/authenticated/disabled"
  },
  "delete": {
    "access": "anonymous/authenticated/disabled"
  },
  "undelete": {
    "access": "anonymous/authenticated/disabled"
  }
}

Remember we are not setting dynamic schema on a table level

@danderson00
Copy link

We're not setting authorize at a table level either as each operation will have this set explicitly

@fabiocav
Copy link
Author

Updated the gist, without the authorize property.

@danderson00
Copy link

customApi.json:

{
  "get": {
    "access": "anonymous/authenticated/disabled"
  },
  "post": {
    "access": "anonymous/authenticated/disabled"
  },
  "put": {
    "access": "anonymous/authenticated/disabled"
  },
  "patch": {
    "access": "anonymous/authenticated/disabled"
  },
  "delete": {
    "access": "anonymous/authenticated/disabled"
  }
}

customApi.js:

module.exports = {
    //"read": function (req, res, next) {
    //}
}

@danderson00
Copy link

schema will be set at the global level - remove this property. I'll add an issue to set the schema from an environment setting.

@mamaso
Copy link

mamaso commented Oct 27, 2015

Custom api templates look good as well

@izerbib
Copy link

izerbib commented Feb 11, 2016

Hi,

I really not understand what does it mean:
// table.read.use(customMiddleware, table.operation);
inside table.js. When I should use it? It's added by default when i create a new 'Easy Table' from the Azure dashboard, but there is not explanation or tutorial. The table.js is not clear. Can you explain me how i can add CRUD operation with a real example?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment