Emvicify CLI
Scaffolding tool for Emvicify
Installation
You can install the package from npm.
npm i -g @emvicify/cli
Usage
For the complete command list, please go to the Wiki - CLI Command List page
mfy --help
emvicify --help
Getting started
- Run the command in your NPM Project folder
mfy here
- Follow the wizard
- (Optional) Power emvicify with its plugins
Happy coding ;)
CLI Commands Examples
For the complete command list, please go to the Wiki - CLI Command List page
Add a new controller - it'll create an UsersController class
mfy add:controller Users
or
mfy ac Users
Add a new router - it'll create an AuthRouter class
mfy add:router Auth
or
mfy ar Auth
Add a new service - it'll create an UsersManagementService class
mfy add:service UsersManagement
or
mfy as UsersManagement
Add a new empty middleware - it'll create an AuthMiddleware class
mfy add:middleware Auth
or
mfy am Auth
Add a new Basic Authentication middleware (overriding all virtual methods for you to use it)
mfy am --authentication basic --with-overrides Auth
FAQ
How can I add an express plugin?
You can add a function called "configureAppBeforeServe" with your custom implementation.
Complete example
const { start } = require("emvicify");
const settingsFile = require("./settings.json");
const expressSettings = {
bodyParserJson: true,
bodyParserUrlencoded: true,
bodyParserRaw: false
};
function configureAppBeforeServe(app, http) {
// Extra express plugin
const cors = require("cors");
app.use(cors());
}
start(process.cwd(), settingsFile.port, { settingsFile, expressSettings, configureAppBeforeServe }).then(() => {
console.log(`Listening on port ${settingsFile.port}`);
}, err => {
console.error("Application failed", err);
});