连接rest不处理请求

我有我的app.js文件中的代码来处理API请求

app.use('/api', cors()); rest.get('/posts', function(req, content, cb) { Post.find(function(err, posts) { if (err) return cb({error: 'Internal error.'}); cb(null, posts.map(function(p) { return { title: p.title }; })); }); }); var apiOptions = { context: '/api', domain: require('domain').create(), }; apiOptions.domain.on('error', function(err){ console.log('API domain error.\n', err.stack); setTimeout(function(){ console.log('Server shutting down after API domain error.'); process.exit(1); }, 5000); server.close(); }); app.use(rest.rester(apiOptions)); 

当我向http://localhost:3000/api/posts发出获取请求时,我收到了此信息消息

 info: Request won't be handled by connect-rest 

之后是关于找不到意见的一些错误,因为我还没有任何意见。 我如何获得连接rest来处理这些请求?

我有同样的问题,并通过移动app.use(rest.rester(apiOptions));来解决它app.use(rest.rester(apiOptions)); 在第一个API方法定义的行的上方(第一次使用rest.get(...) )。