Server -> Client
- test server with Postman
- fix react server err with adding err_msg keyword (SKIP_PREFLIGHT_CHECK) in .env file in client
*
Date.now : function reference
Date.now() : create Date object
*
require(folder) => exports ‘index.js’ file in the folder
*
req.params(id) -> findById(id) works
Because id is the primary key of the Schma, which works as Index
*
findByIdAndUpdate()
mongoosejs.com/docs/api.html#model_Model.findByIdAndUpdate
Mongoose v5.11.17: API docs
mongoosejs.com
*
always put cors at the top, otherwise router will work without applying cors
*
import .vs. require
masteringjs.io/tutorials/node/import-vs-require
Import vs Require in Node.js
Now that Node.js has native support for ESM imports, should you use require()
or import
? Here’s what you need to know.
masteringjs.io
*
personalise Date type fomat
momentjs.com/
Moment.js | Home
Format Dates moment().format(‘MMMM Do YYYY, h:mm:ss a’); moment().format(‘dddd’); moment().format(“MMM Do YY”); moment().format(‘YYYY [escaped] YYYY’); moment().format(); Relative Time moment(“20111031”, “YYYYMMDD”).fromNow(); moment(“20120620”, “YYYYMMDD”
momentjs.com
[ Index ]
[ Router ]
[ Controller ]
[ Model ]
[ App ]
[ ApiService ]
[ TopicForm ]
[ TopicList ]
[ TopicItem ]