28 Kasım 2010, Pazar
Nasıl node.js YAZILAN veri ayıklamak mı?
Nasıl form verileri (form[method="post"]
) ve dosya yükleme node.js POST
HTTP yöntemi gönderilen ayıklamak mı? Belgeleri okumak ve Google'dan araştırdım ve hiçbir şey bulamadım.
function (request, response) {
//request.post????
}
Veya bir hack bir kütüphane var mı?
CEVAP
30 Kasım 2010, Salı
var qs = require('querystring');
function (request, response) {
if (request.method == 'POST') {
var body = '';
request.on('data', function (data) {
body = data;
// Too much POST data, kill the connection!
if (body.length > 1e6)
request.connection.destroy();
});
request.on('end', function () {
var post = qs.parse(body);
// use post['blah'], etc.
});
}
}
Bunu Paylaş:
Nasıl json YAZILAN veri nesnesi olarak...
Veri bağlama Nasıl çalışır?AngularJS :...
Nasıl node.js uygulama hata ayıklama...
Nasıl Node.js komut satırı geçmesi?...
Node.js amacı modülü nedir.ihracat ve ...