SORU
13 Mayıs 2011, Cuma


Nasıl Node.js HTTPS sunucusu oluşturmak için?

SSL anahtarı ve sertifikası verildi, nasıl bir HTTPS bir hizmet sağlıyor mu?

CEVAP
11 Ocak 2013, Cuma


Express API doc Bu oldukça net bir büyü. Bazı yorumlar ve Node.js HTTPS documentation: bir parçacık ekledim

var express = require('express');
var https = require('https');
var http = require('http');
var fs = require('fs');

// This line is from the Node.js HTTPS documentation.
var options = {
  key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'),
  cert: fs.readFileSync('test/fixtures/keys/agent2-cert.cert')
};

// Create a service (the app object is just a callback).
var app = express();

// Create an HTTP service.
http.createServer(app).listen(80);
// Create an HTTPS service identical to the HTTP service.
https.createServer(options, app).listen(443);

Bunu Paylaş:
  • Google+
  • E-Posta
Etiketler:

YORUMLAR

SPONSOR VİDEO

Rastgele Yazarlar

  • jpmkm1

    jpmkm1

    4 NİSAN 2008
  • Sams Page :D

    Sams Page :D

    15 Mart 2009
  • TecnoTutosPC

    TecnoTutosPC

    19 Kasım 2012