Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
express-markdown-router
Advanced tools
Express middleware for generating pages dynamically using markdown files
Express middleware for generating pages dynamically using markdown files. Say goodbye to explicitly bootstrapping routes in your Express app!
npm install express-markdown-router
You must be using an Express template engine to use this middleware
var express = require('express');
var markdownRouter = require('express-markdown-router');
var app = express();
app.set('port', process.env.PORT || 3000);
// Using the jade template engine
app.set('view engine', 'jade');
// Use the markdownRouter middleware and pass the directory of your .md files
app.use(markdownRouter(__dirname + '/pages'));
app.listen(app.get('port'), function() {
console.log('Server started on port %d', app.get('port'));
});
This will start a server and build an index of routes based on the .md files found in the ./pages
dir
It will then send the local var markdown
from the parsed markdown file inside the index[.ext]
view.
Currently there is one special route: index.md
will map to the root path '/'
All other routes will map page.md
to /page
and page.subpage.md
to /page/subpage
and so on...
The view used to render the markdown files within will default to index[.ext]
. You can change this by passing a second param to the middleware:
// Uses a view called 'markdown'
app.use(markdownRouter(__dirname + '/pages', 'markdown'));
All routes are cached on server start, but in development, the contents of the .md files will not be so you can freely update your pages on the fly before deploying them.
FAQs
Express middleware for generating pages dynamically using markdown files
The npm package express-markdown-router receives a total of 0 weekly downloads. As such, express-markdown-router popularity was classified as not popular.
We found that express-markdown-router 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.