Blog site using node.js and reactjs - register/login with JWT, write/read blog post
eslint, prettier
yarn add --dev eslint
yarn run eslint --init
yarn add eslint-config-prettier
nodemon for automatically server restart
yarn add --dev nodemon
Add this script into package.jason
"scripts": {
"start": "node src",
"start:dev": "nodemon --watch src/ src/index.js"
}
If you don’t need to auto restart yarn start
,
If you need auto restart yarn start:dev
koa-router
yarn add koa-router
esm to use ES Module
yarn add esm
Add jsconfig.json for auto recommend
Node.js
: node v12.13.1Koa
framework
//.env file
PORT=4000
MONGO_URI=mongodb://localhost:27017/blog
JWT_SECRET=
MongoDB
with mongoose
library which is based on ODM(Object Data Modelling)
yarn add mongoose dotenv
DB name: blog
| Filed name | data type | desc |
|———————-|—————-|—————————-|
| title | String | blog post title |
| body | String | blog post content |
| tag | [String] | list of tag |
| publishedDate | Date | published date |
JWT
yarn add jsonwebtoken