Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
express-quick-routes
Advanced tools
Readme
Essentially I wanted a neater way to access my routes on my express servers. That is the intention of this project.
Version 1.0.0 introduces breaking changes to version 0.0.0. Please read the updated documentation for new usage.
Support for nested folders also added in 1.0.0
By default, the module will look for the routes in the root of your project inside the /routes folder relative to the file being executed.
Assuming you have the folder structure:
\
\routes
\routes\index.js
\routes\auth.js
The file \routes\index.js has the functions login() and logout() and the file \routes\auth.js has the functions googleAuth() and googleCallback() then you could use the following code.
var express = require('express');
var app = express();
/* Express options code */
...
/* Setup your routes */
var quickRoutes = require('express-quick-routes');
var router = quickRoutes();
app.get('/auth/google', router.auth.googleAuth);
app.get('/auth/googleCallback', router.auth.googleCallback);
app.get('/login', router.index.login);
app.get('/logout', router.index.logout);
/* Start listening */
app.listen(3000);
If you don't want to store the routes in the default location you can pass an alternate location to the init() like so:
var quickRoutes = require('express-quick-routes');
var router = quickRoutes('/opt/site/myRouteFolder');
or a relative path:
var quickRoutes = require('express-quick-routes');
var router = quickRoutes('../../anotherRouteFolderLocation');
If you have any questions or find any bugs please let me know and I'll be sure to address them.
For testing (very simple tests):
npm test
FAQs
A quick and easy way to include all your Express routes.
The npm package express-quick-routes receives a total of 4 weekly downloads. As such, express-quick-routes popularity was classified as not popular.
We found that express-quick-routes 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.