- Create express.js web-server according to Express.js - SHORT GUIDE
-
Create simplest local proj db in """data/products.js"""
See the Pen 2-local-db-file by Andrii (@imitator) on CodePen.
-
In controllers/products/getAll.js use db file in place of the
static array
Static data in controller (OLD) const getAll = (req, res) => {
res.json([{name: 'IPhone5',price: 10000,}]);};module.exports = getAll;Data from local db file (NEW)See the Pen 5-a-getAll.js (from localDB file) by Andrii (@imitator) on CodePen.
- Add post, getById, update & delete controls according to Controllers making guide (local db file)