npx izm
# Then follow the wizard
git clone git@github.com:izmjs/izmjs.git new-project
cd new-project
npm i
echo "NODE_ENV=development" > .env/.common.env
cp .example.env .env/.development.env
Optional: Add devtools
functional module:
git clone git@github.com:izmjs/devtools.git modules/devtools
npm i
Start the project
npm start
npm start
- starts a dev server with nodemonnpm test
- runs tests withmocha
npm run generate:module [name]
- generate a new module (Optionnally you can give the name in the command line, otherwise you will be prompted to choose a name.)
This shortcut will put a definition of new IAM rules in the file.
Will generate a new route
Will generate the definition of a method.
Create new controller.
Generate a new mongoose model.
To skip loading a module, specify it in the env variable SKIP_MODULES
Example
SKIP_MODULES=modules/devtools,modules/data-browser
In order to define new paths of a specific template, use the file config/lib/views.js(on)
.
Example
(module.exports = {
"vendor/core/views/404": "views/{{req.i18n.language}}/404"
})
In the examples above, we are redefining how to render 404
pages depending on the language of the current user. Meaning, if the language is en
for example, the server will look for a file named views/en/404.server.view.swig
. If not found, the server will render the default file: vendor/core/views/404
.
Tip: Use req.rndr
to render a template without sending a response to the client.
You need to define these environment variables in your repository:
PRODUCTION_URL
: The production URLPRODUCTION_DEPLOY_SERVER
: List of production servers addresses or IP addresses. Should be separated by,
.PRODUCTION_DEPLOY_PATH
: Where to deploy project on production hosts.PRODUCTION_SSH_PRIVATE_KEY
: The SSH key to use to connect to production servers.STAGING_URL
: The staging URLSTAGING_DEPLOY_SERVER
: List of staging servers addresses or IP addresses. Should be separated by,
.STAGING_DEPLOY_PATH
: Where to deploy project on staging hosts.STAGING_SSH_PRIVATE_KEY
: The SSH key to use to connect to staging servers.
MIT © Mohamed IDRISSI