wscore v0.0.9
wscore - WebServe core utility modules
WSCore contains a set of modules acting as an abstraction layer between Node.js and WebServe. WSCore provides utility functions for the major task WebServe has to accomplish and can be used for other purposes too. Just install the module and require your wanted features, for example:
const colors = require('wscore/colors');
const logger = require('wscore/logger');
logger.log(colors.green('Works as expected!'));
Module Descriptions
All modules can be imported using the wscore
prefix followed by a forward slash and the module name, e.g
const colors = require('wscore/colors');
Colors
A simple wrapper for using ansi color codes to color your console output.
Config
A minimal module for loading and managing json configuration files.
Crypto
A wrapper for the Node.js crypto module exposing functions for random strings, timing-safe comparison, hash generation, etc.
DateTime
Simple date-/time-string formatting using default Date objects.
Error
A custom Error module derived from the default JavaScript Error object. Used for collecting more hardware and software information in case of a system fault.
HTTP
A set of modules wrapping the default Node.js http server API. Support for http2 streaming will be added in the future, too.
Request & Response
The http request module (http/request
) offers a wrapper for the default http1.1/tls (http2 support will be added in the future) request objects containing functionality for accessing and working with http headers, the request body content and other request data.
The http response module (http/response
) offers functionality to send data, either in a dynamic way or simply static from the file system, back to the client requesting a resource.
Router
The Router module (http/router
) is a standalone pattern-matching request router that can be used with the default Node.js http server. Providing parameter parsing, custom regex routing and more, the router is a minimal but effective solution for routing http requests.
Proxy
The proxy module offers a built-in reverse proxy to pipe incoming requests to an internal or external target server and pipe the proxy response into the default server response. It also allows to override headers and accepts the default Node.js ClientRequest options.
Logger
A simple logging module for outputting pretty console messages and optionally saving them to files, retrieving previous log data and more.
Util
A set of utility functions for file compression, ETag generation, file-system API wrappers and more.