I used React family bucket and Java’s SpringBoot to reconstruct my personal blog. Although I made it, I still had a lot of problems. Since I am not completely familiar with Java, the written interface may have some flaws, so I recently learned EggJS and used Egg to rewrite the background interface.

project

Project address: github.com/k-water/egg… (please click star^_^)

run

# 1
git clone https://github.com/k-water/egg-blog.git

# 2
cd egg-blog
npm install

# 3Modify the sequelize configuration in config.default.js to change the mysql account password to your own# 4
npm run dev
Copy the code

Interface documentation

API Interface documentation

process

Reference documentation

Egg Official Document

Sequelize (English)

Sequelize (in Chinese)

Technology selection

Background framework: Egg

Database: Mysql

Plug-in: egg – sequelize

The interface test

Tools: the PostMan

Database design

The database design is also slightly different from the previous one, but the difference is the connection between the entities. Entities have

  • blogs
  • comments
  • users
  • catalogs
  • Authorities (User Role)

ER figure as follows

Interentity connection

Developed interfaces

Personal summary

Based on the attitude of learning, I rewrote the background interface of the blog. In general, EGG is quite convenient to use, and the official document is also written well. When you encounter basic problems, you can find similar answers in the official issue, and the writing feels like Java. What I learned this time is that the foundation should be solid, like the design of the database, if you can’t learn well, you can’t start at the beginning, and the written interface is certainly not good enough, because you have to consider the format of the returned data, which interface to return what format and so on. Therefore, the foundation is still very important. I always thought it was useless when I learned it before, and I couldn’t use it anyway. However, IN practice, I found that these skills are needed, and only when I work can I get twice the result with half the effort. Another point is to carefully read the document, do not rush to the next handwritten code, a framework has a preliminary grasp, before starting, so that problems can quickly locate the wrong position. Above, be individual small experience ~