make your own json database "get" "post" code example
Example 1: How to use my constants in Larvel
Create a file constants.php inside app/config/ and put your settings in an array:
<?php
return [
'ADMIN_NAME' => 'administrator'
];
Then anywhere in your controllers or views you can get the value by using Config Facade:
echo Config::get('constants.ADMIN_NAME');
Example 2: example of validating fields on your own in express
const User = require('./models/user')
exports.createUser = (req, res, next) => {
const { userName, email, phone, status } = req.body
if (userName && email && isValidEmail(email)) {
User.create({
userName,
email,
phone,
status,
})
.then(user => res.json(user))
.catch(next)
}
}