New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

hops-server

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hops-server - npm Package Compare versions

Comparing version 9.0.1 to 9.1.1

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

<a name="9.1.1"></a>
## [9.1.1](https://github.com/xing/hops/compare/v9.1.0...v9.1.1) (2017-12-05)
**Note:** Version bump only for package hops-server
<a name="8.0.0"></a>

@@ -8,0 +16,0 @@ # [8.0.0](https://github.com/xing/hops/compare/v7.4.1...v8.0.0) (2017-11-22)

35

index.js

@@ -7,16 +7,20 @@ 'use strict';

function defaultCallback (error) {
function defaultCallback(error) {
if (error) {
console.error(error.stack.toString());
} else {
console.log('hops: Server listening at ' + url.format({
protocol: hopsConfig.https ? 'https' : 'http',
hostname: hopsConfig.host === '0.0.0.0' ? 'localhost' : hopsConfig.host,
port: hopsConfig.port
}));
console.log(
'hops: Server listening at ' +
url.format({
protocol: hopsConfig.https ? 'https' : 'http',
hostname:
hopsConfig.host === '0.0.0.0' ? 'localhost' : hopsConfig.host,
port: hopsConfig.port,
})
);
}
}
exports.run = function run (app, callback) {
var server = app.listen(hopsConfig.port, hopsConfig.host, function (error) {
exports.run = function run(app, callback) {
var server = app.listen(hopsConfig.port, hopsConfig.host, function(error) {
(callback || defaultCallback)(error, server);

@@ -26,7 +30,6 @@ });

exports.rewritePath = function rewritePath (req, res, next) {
var location = hopsConfig.locations.find(function (location) {
exports.rewritePath = function rewritePath(req, res, next) {
var location = hopsConfig.locations.find(function(location) {
return (
location !== hopsConfig.basePath + '/' &&
req.url.indexOf(location) === 0
location !== hopsConfig.basePath + '/' && req.url.indexOf(location) === 0
);

@@ -40,5 +43,5 @@ });

exports.registerMiddleware = function registerMiddleware (app, middleware) {
exports.registerMiddleware = function registerMiddleware(app, middleware) {
if (hopsConfig.locations.length) {
hopsConfig.locations.forEach(function (location) {
hopsConfig.locations.forEach(function(location) {
app.get(location === '/' ? location : location + '*', middleware);

@@ -51,4 +54,4 @@ });

exports.bootstrap = hopsConfig.bootstrapServer || function () {};
exports.bootstrap = hopsConfig.bootstrapServer || function() {};
exports.teardown = hopsConfig.teardownServer || function () {};
exports.teardown = hopsConfig.teardownServer || function() {};
{
"name": "hops-server",
"version": "9.0.1",
"version": "9.1.1",
"description": "Provides common functionality for express-like servers",
"keywords": [
"hops",
"webpack-dev-server",
"express"
],
"keywords": ["hops", "webpack-dev-server", "express"],
"license": "MIT",
"main": "index.js",
"files": [
"index.js"
],
"files": ["index.js"],
"repository": {

@@ -20,4 +14,4 @@ "type": "git",

"dependencies": {
"hops-config": "^9.0.1"
"hops-config": "9.1.1"
}
}

@@ -11,16 +11,14 @@ # Hops Server

- `rewritePath(request, response, next) => void`
* `rewritePath(request, response, next) => void`\
`rewritePath` is an express-style middleware that adds a trailing slash to the url of the incoming request.
- `registerMiddleware(app, middleware) => void`
* `registerMiddleware(app, middleware) => void`\
`registerMiddleware` is a helper function that registers a wildcard middleware for every location defined in the hops-config, if available. Otherwise it registers the given middleware for a wildcard route at the root.
- `run(app, callback) => void`
* `run(app, callback) => void`\
`run` is a helper function that starts the express-like server with the parameters defined in hops-config.
- `bootstrap(app, hopsConfig) => void`
`teardown(app, hopsConfig) => void`
These functions allow to customize the server through hops-config. It is possible to define `hopsConfig.bootstrapServer` and `hopsConfig.teardownServer`to override these functions and execute some custom logic on the `app` object.
* `bootstrap(app, hopsConfig) => void`\
`teardown(app, hopsConfig) => void` These functions allow to customize the server through hops-config. It is possible to define `hopsConfig.bootstrapServer` and `hopsConfig.teardownServer`to override these functions and execute some custom logic on the `app` object.
### Target Audience

@@ -30,6 +28,6 @@

### Example
#### `app.js`
```javascript

@@ -36,0 +34,0 @@ var path = require('path');

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