Reputation: 473
I'm using windows azure in order to manage my application's data.
I have a custom API called 'shared' that contains app the code handles push notifications. from another API, I can call this method using this code:
var operations = require('./shared').operations;
operations["sendPush"](/*parameters*/);
When I call the same code from a table's 'insert' script I get this error:
Error in callback for table '*****'. Error: Cannot find module './shared'
[external code]
at Object.sendPush [as success] (</table/*****.insert.js>:57:30)
[external code]
Somebody knows how to fix it?
I think the secret as at the url './shared', cause from an API, it on the same path but from table the path is different.
Does anyone knows what is the path for URL requests to add a table row?
Upvotes: 0
Views: 627
Reputation: 14214
Shared scripts should reside in the service/shared folder. Then you can require them from other scripts using a relative path, like so:
require('../shared/mysharedscript.js')
Upvotes: 1
Reputation: 26
I suceed. By creating a GIT repo I could access to the shared folder. This folder used for things just like this. You can see a documentation in the readme file inside shared folder.
Upvotes: 1
Reputation: 2610
I wonder if it could be a scoping issue because you are in the callback for your insert script?
You could try moving var operations = require('./shared').operations;
to the start of your script, before the insert operation.
Upvotes: 1