Skip to content

Instantly share code, notes, and snippets.

@jamesrwhite
Last active December 17, 2015 12:19
Show Gist options
  • Save jamesrwhite/5608677 to your computer and use it in GitHub Desktop.
Save jamesrwhite/5608677 to your computer and use it in GitHub Desktop.
riak-js issue
// Dependencies
var http = require('http');
express = require('express'),
path = require('path'),
db = require('riak-js').getClient({ debug: true }),
app = express();
// All environments
app.set('port', process.env.PORT || 3000);
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
// Development only
if ('development' === app.get('env')) {
app.use(express.errorHandler());
}
// Api index
app.get('/api', function(req, res) {
db.save('hello', 'test', { works: 'fine' }, function(error, data) {
console.log(error, data);
});
res.end('hey');
});
// Go!
http.createServer(app).listen(app.get('port'), function() {
console.log('Express server listening on port ' + app.get('port'));
});
@jamesrwhite
Copy link
Author

When I run this I always get null and undefined returned, is there something I'm missing? I'm pretty new to both node node and riak so I could be being stupid..

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