访问sails.js的基础http服务器 [英] access base http server of sails.js

查看:133
本文介绍了访问sails.js的基础http服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法访问sails的基本http服务器上下文?我想在我的应用程序中使用 binaryJS,并且在 gettig 入门指南中,他们正在谈论自己创建服务器,如果您有一个现有的 Express 应用程序,其中包含以下行:

Hi is there a way to access the base http server context of sails? I want to use binaryJS in my app and In the gettig started guide they are talking about creating the server at your own, it you have an existing express app with the following line:

var server = http.createServer(app).listen(9000);

我可以使用以下 binaryJS 命令:

than I could use the following binaryJS command:

// Create a BinaryServer attached to our existing server
var binaryserver = new BinaryServer({server: server, path: '/binary-endpoint'});

谢谢

推荐答案

在 Sails v0.10.x 中,您可以通过以下方式访问底层 Express 服务器:

In Sails v0.10.x, you can access the underlying Express server with:

sails.hooks.http.server

在 v0.9.x 中是

in v0.9.x, it's

sails.express.server

这篇关于访问sails.js的基础http服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆