例如,我正在运行节点中最基本的webServer(我正在使用Windows),其中包含以下代码(名为server.js):
var http = require('http');
http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
res.end('Hello World\n');
}).listen(1337, '127.0.0.1');
console.log('Server running at http://127.0.0.1:1337/');
Run Code Online (Sandbox Code Playgroud)
我想将它作为子进程运行,并且使用以下代码成功完成:
var exec = require('child_process').exec;
var serv = exec('node server.js', function(error, stdout, stderr){
console.log('outputs & errors:' + error, stdout, stderr);
});
Run Code Online (Sandbox Code Playgroud)
但是,一旦运行第二个文件,我什么也得不到.没有"输出和错误",没有"服务器运行在......".如果我在浏览器中键入localhost:1337,我会得到"hello world",所以我知道它正在运行.有没有办法管道"服务器正在运行......"所以我可以"肯定"它在听?
我注意到可以通过将JointJS链接悬停在它们上面并单击出现的大红色X来删除它.但我想知道是否有可能在创建元素后删除元素,而不知道变量名称.
onCreateButtonClick(function(){
var rect = new joint.shapes.basic.Rect({
position: { x: 100, y: 30 },
size: { width: 100, height: 30 }
});
graph.addCell([rect]);
});
onRemoveButtonClick(function(){
//removeRectangle here?
});
Run Code Online (Sandbox Code Playgroud)
我的问题是:我可以在第二个函数中删除这个矩形吗?
<template>
<h1>Hello</h1>
</template>
Run Code Online (Sandbox Code Playgroud)
如果我使用搜索这个
/<template>\_.*template>
Run Code Online (Sandbox Code Playgroud)
如何拉动/剪切所选内容以将其放在文件中的其他位置?
有更好的方法来做这件事吗?