Back to business:
1. Why did you want to write this article?
Answer: In the process of reading this book, the usage is different from the book after the nodejs version is upgraded.
In addition, nodejs is really good and worth learning.
2. What is the difference between my example and the example in the book?
Answer: The nodejs versions are different. The latest version is used in my example. The databases are different. The book uses mongdb, and I use mysql.
models-> Used to place model objects. Examples in the book include post topic and user objects.
node_modules->nodejs modules, such as mysql, express, connect-flash, ejs, jade, etc.
public-> are used to store public resources, such as pictures, javascript, css, etc.
routes-> are used to store routing files and are used to handle various get and post requests (need to be configured in app.js )
utils->Tool class, uuid.js here is used to generate id
views-> to store page files, the same ejs template engine used here as in the book
app.js-> ;Project entrance
database.js->mysql database base class
package.json->System configuration file (including version information of some modules)
setting.js->Database configuration file