cvbsp-directory v1.3.1
Directory and authentification app built on top of express
install
npm i cvbsp-directory
config
add config.json file (inside the working directory in dev mode, outside in production mode), here is the mandatory parameters:
"URL_MONGO":"mongodb://localhost:27017/",
"DB_NAME":"name_of_db"
"PORT":3333, // port number that you wish to use
"PRIVATE_KEY":"4XAgpTaS1RCSrYZ6K5Kq", // private key to use for the password encryption
"LOG_PATH":"./dev.log", // path to the log file
"LOG_LEVEL" : "debug", // any of this "fatal", "error", "warn", "info", "debug"
"TOKEN_EXPIRY_IN_SEC":86400, // timelapse for expiry of the token for authenticated user in seconds
"REQ_LIMIT_MB":100, // Request size limit in Mb
"SUPERVISOR_PASSWORD":"password", // Supervisor password in clear
"DIR_FILES":"./_Files/" // path to the directory where data will be stored
"DEFAULT_LANG": "fr", // default lang uses if no lang define on user
"DOMAIN_ROOT_NAME": "root",
"PREFIX_URL": "/api/v2",
"STATIC_PATH": "/resources", // relative url to access the doc in DIR_FILES from outside
"EXTERNAL_PATH_TO_FILES": "http://localhost:3000/resources/", // external path to access the file, can be outside of the this app
"DEFAULT_DOMAIN_ID": "xxxxx-xxx-xx-xx-xxxx", // id of the default domain to use when user auto-register
"EMAIL" : { // Email sender configuration
"HOST":"url_string",
"PORT":000,
"SECURE":boolean,
"USER":"email_adress",
"PWD":"************",
"DEFAULT_FROM":"email_adress",
"FILE_INIT_PATH": "/path/to/emails.json"
},
"DEFAULT_ROOT_SETTINGS": {
"title": "Cvbsp",
"logo": { "type" : "file" },
"primaryColor": { "type" : "color" },
"secondaryColor": { "type" : "color" },
"successColor": { "type" : "color" },
"dangerColor": { "type" : "color" },
"warningColor": { "type" : "color" },
"prop1": "value1" // to add new setting
}
licence
the licence file is use to activate or desactivate feature, it can be used with plugins, content is an js object:
{}
data
make sure to create an emails file corrsponding to the path "FILE_INIT_PATH": "/path/to/emails.json" in the config file .
email notifications file must have the followings to work properly :
{
"name" : "RESET_PASSWORD",
"subject" : { "en" : "Reset password", "fr" : "Réinitialiser le mot de passe" },
"body" : {
"fr" : "<p>Voici votre code pour réinitialiser votre mot de passe</p><p>Code : ##CODE##</p>",
"en" : "<p>Below is the code to reset your password</p><p>Code : ##CODE##</p>"
},
"isHtml" : true,
"isActive" : true
},
{
"name" : "VERIFY_EMAIL",
"subject" : { "en" : "Verify email", "fr" : "Vérifier votre email" },
"body" : {
"fr" : "<p>Voici votre code pour vérifier votre email</p><p>Code : ##CODE##</p>",
"en" : "<p>Below is the code to verify your email</p><p>Code : ##CODE##</p>"
},
"isHtml" : true,
"isActive" : true
}
use
and then just Use like express:
- Javacsript:
const cvbspDirectory = require('cvbsp-directory');
const newRouter = require('./controller');
App.use('/path', newRouter);
const server = cvbspDirectory.App.listen(3000, () => {
console.log('Express server with cvsbp directory listening on port ' + 3000);
});
- Typescript:
import { App } from 'cvbsp-directory';
import { newRouter } from './controller';
App.use('/path', newRouter);
const server = App.listen(3000, () => {
console.log('Express server listening on port ' + 3000);
require('./all.spec');
});
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago