New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

just-http

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

just-http

Extremely simple http server

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

just-http

Simple, semi-static, http server. Mostly the result of my playing around with the http and fs modules, but it may serve someone.

Installation

Install from npm:

npm install just-http

Usage

Create a new server:

var server = require("just-http").createServer();

Map path to files using regular expressions:

server.map("^/$", "./www-test/index.html");
server.map("^/(.+)$", "./www-test/$1");

Map a path to a function, to serve dynamic content:

server.map("^/dynamic$", function (request, response) {
    try {
        // TODO : do something smart
    } catch (e) {
        // never let exceptions bubble up
        server.sendError(response, e);
    }
});

Start listeneing

server.listen(8080);

Contribute

github repository:

https://github.com/freongrr/node-just-http

FAQs

Package last updated on 16 Feb 2015

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