- set up your MongoDB database and connected it to your Express app;
- used Mongoose to create a data model in order to facilitate database operations;
- implemented CRUD routes in your Express app which leverage your Mongoose data model, rendering your app fully dynamic.
sudo npm install -g npm@latest Use npm update to perform safe dependency upgrades
https://www.digitalocean.com/community/tutorials/how-to-install-mongodb-on-ubuntu-18-04 sudo systemctl status mongodb
to create test user, just use the following code in (user route), after created users, please commented out these lines:
var user = new User( {
email: 'any.email',
password: 'any.password'
} );
user.save();git fetch origin
git reset --hard origin/master
git pull
Explanation:
Fetch will download everything from another repository, in this case, the one marked as "origin".
Reset will discard changes and revert to the mentioned branch, "master" in repository "origin".
Pull will just get everything from a remote repository and integrate.
npm install cookie-parser
Files to edit :
- routes/Employee.js
- router.post("/add", (req, res, next) => { ....
- router.post('/update', (req, res, next) => { ....
- schema/Employee.js
- const employeeSchema = new Schema({ ....
- views/employees.hbs
- <label for="input....
- <input type="....
- ...
- views/static/js/employees.js
- //on EditBtnEmployees click ....
- $("#update_ new field
- //on update employee submit the form
- ajax
- //read list
- item[??].innerHTML=$('#update_ new field').val();
- function getRowHtmlEmployees(item) { ...
-
- getTD(item. new field)