![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
hops-server
Advanced tools
Hops server is a small collection of shared functionality that can be used in express-like interfaces to register the hops-middleware.
It also exports a simple middleware that takes care of rewriting the paths of incoming http requests based on the values set in hops-config.
exports:
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
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
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.
If you want to build an express-like server and reuse the hops-config while doing so, then this middleware will help dealing with the locations and basePath config.
app.js
var path = require('path');
var express = require('express');
var server = require('hops-server');
var hopsConfig = require('hops-config');
// The middleware is being generated by hops-build, based on the webpack node config
var pathToGeneratedMiddleware = path.join(hopsConfig.cacheDir, 'server.js');
var app = express();
app.use(server.rewritePath);
// bootstrap and teardown provide hooks to customize the server through hops-config
server.bootstrap(app, hopsConfig);
server.registerMiddleware(require(pathToGeneratedMiddleware));
// bootstrap and teardown provide hooks to customize the server through hops-config
server.teardown(app, hopsConfig);
server.run(app);
FAQs
Provides common functionality for express-like servers
The npm package hops-server receives a total of 0 weekly downloads. As such, hops-server popularity was classified as not popular.
We found that hops-server demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.