A Lightweight Blog System Based on Node.js and Express.js, Compatible with Desktop, Tablet, and Phone
- en English
- zh_CN Simplified Chinese
h-blog
is a lightweight blog system, supporting responsive interaction, with elegant interface, rich features, compact and fast, comprehensive functionality, and beautiful design.
Hope visitors can gain something. The story doesn't end, and youth doesn't fade.
Project Online Demo:
Deployment Address: https://blog.huanghanlian.com/
Project GitHub: https://github.com/huanghanzhilian/h-blog
The purpose of each file and folder:
models
: Stores files for database operationspublic
: Stores static files such as styles, images, etc.routes
: Stores route filesviews
: Stores template filesindex.js
: Main program filepackage.json
: Stores project name, description, author, dependencies, etc.
Purposes of corresponding modules:
express
: Web frameworkejs
: Templatemongoose
: MongoDB object modeling designed to work in an asynchronous environmentmarkdown-it
: Editor conversionbody-parser
: Formats data from formsmulter
: Image upload component for forms based on multipart/form-data typeunderscore
:_.extend
replaces fields in the old object with fields in the new objectmoment
: Time formattingexpress-session
: Session middlewareconnect-mongo
: Stores session in mongodb, used in conjunction with express-sessionconfig-lite
: Reads configuration files
config/default.js
module.exports = {
port: 3001,
session: {
secret: 'h-blog',
key: 'h-blog',
maxAge: 2592000000
},
mongodb: 'mongodb://localhost:27017/h-blog'
}
Configuration interpretation:
port
: Port number the program listens on when startingsession
: Configuration information for express-sessionmongodb
: MongoDB address, starting with mongodb:// protocol, with h-blog as the db name
Blog Frontend
- Login
- Login Page: GET /signin
- Login: POST /user/signin
- Registration Page
- Registration Page: GET /signup
- Registration: POST /user/signup
- Article List Page
- Article Detail Page