我正在使用带有socketstream的node.js。客户端js文件未加载,并且在调用服务器方法时,我在客户端获取ss未定义错误。
This is my app.js file
var ss = require('socketstream'),
express = require('express');
var app = express();
// Code & Template Formatters
ss.client.formatters.add(require('ss-stylus'));
ss.client.templateEngine.use(require('ss-hogan'));
ss.client.define('main',
{ view: 'app.html',
css: ['libs/reset.css', 'app.styl'],
code: ['libs/jquery.min.js', 'app'],
tmpl: '*' });
// Use Express to route requests
app.get('/', function(req, res){
res.serveClient('main'); });
server = app.listen(3000);
ss.start(server);
// Append SocketStream middleware to the stack
app.stack = ss.http.middleware.stack.concat(app.stack);
This is my server side method rpc method
exports.actions = function(req, res, ss){
return {
saveUserInfo: function(name,pwd){
console.log(name);
console.log(pwd);
res('name is '+name + '&'+'password is '+pwd);
}
}
}