Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app.get() method unknown? #3

Open
bayvictor opened this issue Jul 31, 2014 · 3 comments
Open

app.get() method unknown? #3

bayvictor opened this issue Jul 31, 2014 · 3 comments

Comments

@bayvictor
Copy link

when run "node start.js" (start.js copy-paste from here) having below error:

/sda1/src/social_game/hi5/api-client-js-master/start.js:15
app.get('/', function(req, res) {
^
TypeError: Object function app(req, res, next){ app.handle(req, res, next); } has no method 'get'
at Object. (/sda1/src/social_game/hi5/api-client-js-master/start.js:15:5)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
<start.js code starts >
// Low level access
var TaggedApi = require('tagged-api');
var api = new TaggedApi('http://www.tagged.com/api.php', {
session_id: 'abc123' // Session cookie ID from request
});

// Or use middleware to automatically create an api instance for each request
var connect = require('connect');
var app = connect();
var TaggedApi = require('tagged-api');
app.use(TaggedApi.middleware());
//var server = app.createServer("http://www.tagged.com/api.php")

app.get('/', function(req, res) {
//server.get('/', function(req, res) {
// Make API calls on behalf of the user that is authenticated with this request
req.api.execute('user.whoami').then(function(result) {
res.send(result);
}).done();
});

//+++++++++++++++++++++++++++++++++++++++++++++++++++++++
<start.js code ends >

@bayvictor
Copy link
Author

api.execute('im.send', {
to: 12345,
message: 'Join the party!'
})
also cause
TypeError: Cannot call method 'post' of undefined
at TaggedApi._postToApi (/sda1/src/social_game/hi5/node_modules/tagged-api/lib/index.js:90:20)
at Timer.listOnTimeout as ontimeout
eror,
Do I miss anything? I to a "npm install " "sudo npm install -g " to resolve auto-dependency already.

@djvirgen
Copy link
Contributor

Hi @bayvictor,

The Tagged API client isn't quite production ready, but we're actively working on it. Keep an eye on the README.md -- we'll update it with clearer instructions soon.

@bayvictor
Copy link
Author

Hi Djvirgen,

Thank you for the prompt response, I look forward to playing with your README.md -- step by step working sample -- very soon, where app.get() & TaggedApi._postToApi () won't have any more issue. :)
Cheers,
Victor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants