我是 NodeJS 和 webdriveIO 的新手,正在编写一些 webdriveIO 测试,我有两个功能: 短信服务器();和startTest();
1- smsServer();
function smsServer(){
// parse application/x-www-form-urlencoded
app.use(bodyParser.urlencoded({ extended: false }))
// parse application/json
app.use(bodyParser.json())
app.get('/',function(req,res){
console.log(req.query.text);
});
app.post('/', function(req,res){
console.log("Post");
console.log(req.body);
res.sendStatus(200);
});
app.listen(3000, function(req, res){
console.log('App listening on localhost:3000');
console.log("req: ",req);
console.log("res: ",res);
});
}
2- 开始测试();
只是一些测试 WDIO
我想让我的服务器保持运行以接收一些验证码,而在我的老板杀死我之前执行任何帮助的第二个功能(测试)将不胜感激
最佳答案
在不终止进程或永久使用的情况下为您的应用程序提供午餐。 但是,我认为当您为应用程序提供午餐时,服务器必须仍在运行,
npm install forever
及之后
forever start yourapp
关于javascript - 在执行其余测试时保持 NodeJs 服务器运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44543249/