![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
ezzy-express-mvc
Advanced tools
A complete mvc infrastructure to render pages from a specific directory based.
A complete mvc infrastructure to render pages from a specific directory.
You can use this class to recurse through a directory that contains Controllers, Models and Views to prepare an application with multiple routes mapped accordingly. This utility maps all controllers to their respective views and provides the necessary models to generate the response.
When the application initializes, an instance to the controller is
registered in the express application. Then, at the time of the request,
an instance of the respective model gets injected into the view of the
application. While the model is injected, the code checks for any JS and CSS
assets that exist in the respective assets directory. During production,
this directory is only checked once, but in development, the directory
is checked on every request. Additionally, sass and compass have been
implemented to allow dynamic CSS generation to the corresponding /css
folder.
For example, you can structure your directory in this manner:
And now in your localhost.js file, you can simply invoke it like this:
const ExpressMvc = require('ezzy-express-mvc');
new ExpressMvc(__dirname + '/src')
.promise // we have to wait for file detection.
.then(app => app.listen(9000));
If you'd like to bind other applications to the same port, simply use:
const ExpressMvc = require('ezzy-express-mvc');
new ExpressMvc(__dirname + '/src')
.promise
.then(app => app.bindExpressMvc(__dirname + '/anotherDirectory'))
.then(app => app.listen(9000));
/**
* @param {string} directory The directory of the mvc sources.
* @param {Function|Function[]} middleware Any middleware that's required.
* @param {function({HttpBasics}):boolean} requestFilter The filter function that decides if this instance of the MVC application will handle the request.
* @param {RegExp} domainReg The regular expression for the domain or the function that will check if the route will be resolved.
* @param {string[]|string} statics The static routes to assign before anything. Note: These routes are directories matching the context of the folders within the application.
* @param {boolean} bind404 If we should bind a 404 route after all the controllers are bound to avoid continuing to any other applications.
* @param {string} customErrorDir The custom error directory where the application can find [error-status].html files.
* @param {Function|Function[]} globalMiddleware The global middleware to use on this and all other bound MVC applications.
* @param {express} expressDependency The express instance to be used if a certain version is required.
* @param {string} partials The name of the partials directories.
* @param {string} layouts The name of the layouts directories.
* @param {string} helpersFile The file containing handlebars helpers.
* @param {string[]} partialsDirectories Any additional directories to look for partials.
* @param {string[]} layoutsDirectories Any additional directories to look for layouts.
* @param {string[]} otherStatics Any additional directories to use as static files.
*/
const defaultConfig = {
directory: undefined,
middleware: undefined,
domainReg: /.*/,
statics: undefined,
bind404: false,
requestFilter: undefined,
customErrorDir: 'errors',
globalMiddleware: undefined,
expressDependency: undefined,
partials: undefined,
layouts: undefined,
helpersFile: undefined,
partialsDirectories: [],
layoutsDirectories: [],
otherStatics: []
};
FAQs
A complete mvc infrastructure to render pages from a specific directory based.
The npm package ezzy-express-mvc receives a total of 0 weekly downloads. As such, ezzy-express-mvc popularity was classified as not popular.
We found that ezzy-express-mvc 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
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.