项目作者: AreumAn

项目描述 :
Blog site using node.js and reactjs - register/login with JWT, write/read blog post
高级语言: JavaScript
项目地址: git://github.com/AreumAn/react-blog.git
创建时间: 2020-02-25T08:38:08Z
项目社区:https://github.com/AreumAn/react-blog

开源协议:

下载


react-blog


Dev set up

  • eslint, prettier

    1. yarn add --dev eslint
    2. yarn run eslint --init
    3. yarn add eslint-config-prettier
  • nodemon for automatically server restart

yarn add --dev nodemon

Add this script into package.jason

  1. "scripts": {
  2. "start": "node src",
  3. "start:dev": "nodemon --watch src/ src/index.js"
  4. }

If you don’t need to auto restart yarn start,

If you need auto restart yarn start:dev

  • koa-router

    1. yarn add koa-router
  • esm to use ES Module

    1. yarn add esm
  • Add jsconfig.json for auto recommend


Backend

  • Node.js: node v12.13.1
  • Koa framework

    1. //.env file
    2. PORT=4000
    3. MONGO_URI=mongodb://localhost:27017/blog
    4. JWT_SECRET=
  • MongoDB with mongoose library which is based on ODM(Object Data Modelling)

    1. yarn add mongoose dotenv
    • Dotenv is a zero-dependency module that loads environment variables from a . env file into process. env . Storing configuration in the environment separate from code is based on The Twelve-Factor App methodology.
  • 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

    1. yarn add jsonwebtoken
  • sanitize-html library

Frontend