Simple many people Blog example with Express, Xtpl, Mysql
This example covers following topics;
express
mysql
xtpl
session
routes
Quick links ;
We'll be using an existing application that includes two models, several routes, and several views.
-
Fork and clone this repository
-
Run
npm install
to install dependencies- Use
npm start
to start your application in development
- Use
-
Setup your database (this app already has create mysql database file)
-
install Mysql
- copy blog.sql content code to create database
After setup, STOP. You're using an existing application, so make sure to read the code and ensure what the application does. Here is some information about the current setup.
-
Routes
GET /
- Render home pageGET /account/login
- Get login pagePOST /account/login
- Process the login requestGET /account/register
- Render reginster pagePOST /account/register
- Process the register requestGET /account/logout
- Process the logout requestGET /article/publish
- Render publish article pagePOST /article/publish
- Render publish article pageGET /article/details/:id
- Render detail article pageGET /article/page/:pageNum/:postAmount
Get home page article list
-
Models
article model
user model
- Use Constructor(class) encapsulation database operation models
- Login
- Register
- Publish article
- Photo upload
- Edit article
- User personal homepage
- Optimization