标签: node.js-client

Node.js - 如何从html发送数据到express

这是html中的表单示例:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>CSS3 Contact Form</title>
</head>
<body>
<div id="contact">
    <h1>Send an email</h1>
    <form action="/myaction" method="post">
        <fieldset>
            <label for="name">Name:</label>
            <input type="text" id="name" name="name" placeholder="Enter your full name" />

            <label for="email">Email:</label>
            <input type="email" id="email" placeholder="Enter your email address" />

            <label for="message">Message:</label>
            <textarea id="message" placeholder="What's on your mind?"></textarea>

            <input type="submit" value="Send message" />

        </fieldset>
    </form>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是在服务器上运行的node.js函数:

var sys = require('sys'),
    http = require('http');
    http.createServer(function (req, res) {
            switch (req.url) 
                case '/myaction':
                        res.end(?????);
                    break;
            } …
Run Code Online (Sandbox Code Playgroud)

forms html5 http-post node.js node.js-client

40
推荐指数
1
解决办法
13万
查看次数

node.js客户端中的Windows集成身份验证

使用node.js作为客户端时,是否可以使用Windows集成身份验证连接到服务器(例如,连接到IIS时)?

我对此的搜索仅显示结果,其中node.js用作服务器.

windows windows-authentication node.js node.js-client

24
推荐指数
2
解决办法
3万
查看次数

Node.js中本地模块和全局模块有什么区别?何时使用本地和全局模块?

我们可以使用require函数访问本地模块,但不能通过它访问全局模块.我在某处读到要使用全局模块,我们需要将其设置为本地,然后通过require函数导入它.因此,如果我们无法直接访问全局模块,那么使用它的需求是什么.

node.js npm node.js-client node.js-domains node.js-stream

15
推荐指数
1
解决办法
6309
查看次数

如何在node.js客户端中执行Auth

我想通过身份验证来使用这个rest api.我正在尝试包括标题但没有得到任何回复.它抛出的输出通常在没有认证时抛出.谁能建议我一些解决方案.下面是我的代码

var http = require('http');

var optionsget = {
    host : 'localhost', // here only the domain name

    port : 1234,

    path:'/api/rest/xyz',
            headers: {
     'Authorization': 'Basic ' + new Buffer('abc'+ ':' + '1234').toString('base64')
   } ,
    method : 'GET' // do GET

};

console.info('Options prepared:');
console.info(optionsget);
console.info('Do the GET call');

var reqGet = http.request(optionsget, function(res) {
    console.log("statusCode: ", res.statusCode);

    res.on('data', function(d) {
        console.info('GET result:\n');
        process.stdout.write(d);
        console.info('\n\nCall completed');
    });

});

reqGet.end();
reqGet.on('error', function(e) {
    console.error(e);
});
Run Code Online (Sandbox Code Playgroud)

basic-authentication node.js node.js-client

9
推荐指数
1
解决办法
3万
查看次数

为什么 clearInterval 对函数不起作用

这是代码

var t = ()=>{

    setInterval(()=>{

        console.log('hello')

    },1000)


}

t();

clearInterval(t)
Run Code Online (Sandbox Code Playgroud)

为什么 clearinterval 不会阻止 setInterval 的执行?

javascript node.js node.js-connect node.js-client

4
推荐指数
1
解决办法
1309
查看次数

Windows Azure节点JS WEBSOCKET握手失败503错误

我在windows azure中部署了nodeJS服务器.连接到服务器时我的客户端失败并处理以下错误:

WebSocket connection to 'wss://ooplrfrfranode.azurewebsites.net/socket.io/1/websocket/lHrd-DOydinODjbS7-tc' failed: Error during WebSocket handshake: Unexpected response code: 503.
Run Code Online (Sandbox Code Playgroud)

请帮忙.谢谢.

azure node.js http-status-code-503 node.js-client

3
推荐指数
2
解决办法
2864
查看次数