Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

billy-http-express

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

billy-http-express

A Billy service that creates an Express 4 HTTP server

  • 1.4.2
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

billy-http-express

Build Status NPM version

A Billy service that creates an Express 4 HTTP server.

Install

$ npm install billy-http-express

Usage

var Application = require('billy');
var HttpService = require('billy-http-express');

var app = new Application();
app.service(HttpService);
app.config('http.port', 8889);

app.start();

The actual server is started after all services have been loaded, so registering any middleware or setting up of express should happen after this service via the http dependencies.

app.service(function MyWebService(http) {
  http.use(cookieParser());
  http.get('/', function(req, res) {
    res.send('Hello, World!');
  });
});

This can be done in a separate service following this one, or via specifying a module via the http.server config.

Injectables

New dependencies that you can use after adding this service:

tagtypedescriptionnotes
httpexpressThe express applicationSetup routes, middleware, etc with this object

Configs

Available config properties:

configtypedescriptiondefault valuenotes
http.portnumberPort to listen on for HTTP connectionsprocess.env.PORT, 8123 1
http.secretstringServer-side secret'supersecret'Used for securing cookies.
http.webrootstringPath to directory of static files to servenullOptional. If not set, will not start the static server. If an array, will serve multiple directories2
http.serverfunctionServer startup modulenullOptional IoC-injected module to start when the server is created. 3
http.usernamestringHTTP basic auth usernameprocess.env.HTTP_USERNAME, nullIf null, any username will be accepted. 4
http.passwordstringHTTP basic auth passwordprocess.env.HTTP_PASSWORD, nullIf null, any password will be accepted. 4

1 Will use the PORT environment variable if available, e.g. on Heroku.

2 The static server is mounted during the start phase of this service, meaning all middleware mounted in the setup / constructor function of other services will have precedence, as will any services that start before this one.

3 The http.server module must be set before the app is started since it is booted with the HTTP service starts.

4 Basic auth will only be enabled if either http.username or http.password is set

Testing

$ npm test

License

MIT

Keywords

FAQs

Package last updated on 15 Sep 2014

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc