alcwa_base_server
v1.2.3
Published
``` npm i alcwa_base_server ``` ## Server ### getConfig Function used to validate the env variable format (upper case) #### usage ```javascript export default { port: getConfig('PORT') } ``` ### mustProvide Function used to throw an error if the specifie
Downloads
49
Readme
Base Server
install
npm i alcwa_base_serverServer
getConfig
Function used to validate the env variable format (upper case)
usage
export default {
port: getConfig('PORT')
}mustProvide
Function used to throw an error if the specified field is not provided
usage
function myFunction(param = mustProvide('param')) {
// Param provided
}logger
Function used to log info or errors
usage
const message = 'Hi boy!';
logger.info(message);const error = new Error();
error.message = 'You failed';
error.status = 500;
logger.error(error);mongoCollection
Function to return a mongo collection
usage
const userCollection = mongoCollection('user');
userCollection.insertOne({
name: 'toto',
age: 29
});