Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

trench

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

trench

Simplistic, promise-based web framework for node.

latest
Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

trench

Build Status

:large_orange_diamond: Simplistic, promise-based web framework for node.

Features

  • Supports new ES6 features such as Promises and Sets.
  • Supports all HTTP methods listed in http.METHODS.
  • Prioritises speed and simplicity over a large feature-set or extensive options.
  • API modeled on the ever-popular Express.
  • In equivalent "Hello, World!" examples, it's faster than both hapi and Express.

Usage

  • Requires Node 6.0+
const Trench = require("trench");

const app = new Trench();

app.get("/", (req, res) => {
	res.end("<h1>Hello, World!</h1>");
});

app.listen(8080);

API

new Trench()

Returns a new app instance.

const app = new Trench();

Trench#use(function)

Specifices a middleware function to be used.

app.use((req, res) => {
	res.locals.startTime = Date.now();
});

Trench.static(root)

Returns a middleware function for serving static files.

app.use(Trench.static(__dirname + "/static"));

Trench#get(path, [ function, [ function, [ function ]]])

Specifices a GET route for the given path.

app.get("/", (req, res) => {
	res.locals.name = "Monty";
}, (req, res) => {
	res.end(`Hi, ${res.locals.name}!`);
});

FAQs

Package last updated on 08 Nov 2016

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