- git - Installation guide .
- node.js - Download page .
- npm - comes with node or download yarn - Download page .
- mongodb - Download page .
- postman - Download page
- mongoose - Api
- MongoDB - CRUD API
git clone https://github.com/vdanyliv/mongoose-workshop
cd mongoose-workshop
npm install
npm start
Lets try to implement possibility to create users articles, for that we need to implement CRUD operations.
- Create Schema and Model for articles
- Add owner path to article schema
- Add schema validation
- Before creating new article need to check if item and user already exist (search by title)
{
title: String,
description: String,
owner: ObjectId,
createdAt: Date,
updatedAt: Date
}
- Check if article exist
- Update article document
- User will have possibility to sort articles
- User will have possibility to filter articles
- User will have possibility to use pagination
- Populate owner of the article
- Check if article exist
- Delete article
- Create end-point that will retriwe articles for specific user
- Create end-point that will remove all articles for specific user
- We will use postman as a request emulator, back-end url http://localhost:port/api/