![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.
pathologist-middleware
Advanced tools
Finding the right path since 1967
Note: This project is in early development, and versioning is a little different. Read this for more details.
Often when building a static app, you want to serve multiple routes with the same static file while keeping the URL structure intact for your app's routing logic. Or perhaps you just want to handle multiple routes for a directory of static files.
Pathologist is an easy to use connect middleware for bringing your single page apps to life. You can define routes with supported globstar matching to serve your static files.
Pathologist simply rewrites the request url to a new static file path. It does not serve the static file for you, so you will need to use your preferred static server middleware with pathologist. We recommend alchemist.
$ npm install pathologist-middleware --save
Pathologist accepts an options object which takes globstar-compatible paths as keys and a static file path as values. Routes are matched in the order they are defined in the object. Here's an example that serves an admin client on any URLs starting with /admin
, and serves the user client on all other routes.
var http = require('http'),
connect = require('connect'),
pathologist = require('pathologist-middleware');
var app = connect().use(
pathologist({
'/admin/**/*': '/admin.html',
'/**': '/index.html'
})
);
You can also pass a base path to be used with your file path values as the first argument.
var http = require('http'),
connect = require('connect'),
path = require('path'),
pathologist = require('pathologist-middleware');
var app = connect().use(
pathologist(path.join(__dirname, 'browser'), {
'/admin/**/*': 'admin.html',
'/**': 'index.html'
})
);
Without a base path, the path values passed into pathologist can be either absolute paths, or relative paths from process.cwd()
.
FAQs
Handling custom static routes since 1967
The npm package pathologist-middleware receives a total of 0 weekly downloads. As such, pathologist-middleware popularity was classified as not popular.
We found that pathologist-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.