Socket
Book a DemoInstallSign in
Socket

studify

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

studify

Easily put your node server behind `stud` SSL terminator

latest
Source
npmnpm
Version
0.1.0
Version published
Maintainers
1
Created
Source

studify

Easily put your node server behind stud SSL terminator

Installation

You need stud installed first. Then:

npm install studify

Usage

The following starts an HTTP server on random port and stud "in front" of it port 8433.

var path = require('path');
var http = require('http');
var studify = require('studify');

var server = http.createServer(function (req, res) {
  res.writeHead(200, { 'content-type': 'text/plain' });
  res.end('Hello, stud!\n');
});

studify(server, {
  cert: path.join(__dirname, 'server.pem'),
  port: 8433,
  log: function () { console.log.apply(console, arguments); }
});
server.listen();

API

studify(server, options)

  • server (net.Server) - server stud is supposed to forward traffic to
  • options (Object)
    • options.port (number) - required. Port to start stud on
    • options.cert (string) - required. Path to PEM file with the certificate
    • options.stud (string) - stud binary, default: "stud"
    • options.ssl (boolean) - whether to use SSLv3 or not, default: true if server is an instance of http.Server
    • options.workers (number) - number of stud workers, default: 1

Returns an EventEmitter, which emits following events:

  • restart(code, signal) - stud crashed and had to be restarted
  • error(err) - ChildProcess emitted an error event

FAQs

Package last updated on 21 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts