Skip to content

Instantly share code, notes, and snippets.

//app.js
var users = app.resource('users', require('./controllers/users'));
users.map('get', '/login', users.login);
//users.js
exports.login = function(req, res){
res.end('login');
};
//error
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/imagick.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mcrypt.ini on line 1 in Unknown on line 0
PHP Deprecated: Comments starting with '#' are deprecated in /etc/php5/cli/conf.d/mhash.ini on line 1 in Unknown on line 0
No log handling enabled - turning on stderr logging
MIB search path: /root/.snmp/mibs:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (HOST-RESOURCES-MIB): At line 1 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 1 in (none)
Cannot find module (SNMPv2-TC): At line 10 in /usr/share/mibs/netsnmp/UCD-DLMOD-MIB
Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/mibs/netsnmp/UCD-SNMP-MIB
Cannot find module (SNMPv2-TC): At line 37 in /usr/share/mibs/netsnmp/UCD-SNMP-MIB
exports.create = function(req, res, next){
req.form.on('fileBegin', function(name, file){
console.log(file);
console.log(name);
});
req.form.on('progress', function(bytesReceived, bytesExpected){
if (bytesExpected > app.settings.maxUpload) {
next(new Error('File larger than ' + app.settings.maxUpload/1024 + ' megabytes.'));
}
var twitter = require('ntwitter')
, jsdom = require('jsdom')
, Log = require('log')
, fs = require('fs')
, log = new Log('info', fs.createWriteStream('app.log'))
, XXX;
var twit = new twitter({
consumer_key: 'XXX',
consumer_secret: 'XXX',
var fs = require('fs')
, async = require('async');
exports.newUpload = function(path, f) {
var i = 0
, p = path;
async.until(
function () {
p = (i !== 0) ? path + i : path;
// FIRST WAY
//routes.js
module.exports = function (app, client, config) {
var Index = require('../controllers/index')
, index = new Index(app, client, config);
app.get('/', index.index);
};
//index.js
var hostname = url.parse(post.url).hostname;
if (hostname.indexOf('vimeo') != -1) {
var id = url.parse(post.url).pathname;
if (id) {
post.type = 'vimeo';
post.videoID = id;
} else {
post.type = 'link';
}
} else if (hostname.indexOf('youtu') != -1) {
// user model
module.exports = function (user) {
// new user with 'user'
this.save = function() {
// save 'user'
};
};
var User = function (user) {
this.user = user;
};
User.prototype.all = function (callback) {
var User = this;
var users = [];
/* snip */
callback(error, users);
};
// USER MODEL
var User = function (user) {
this.user = user;
};
User.prototype.all = function (callback) {
var User = this;
var users = [];
/* snip */