Code
Source link: https://pan.baidu.com/s/1Sz2lcc-s7mfvenisDFshNA
Extraction code: 643l
Case Introduction
Realization idea
- Create project folder and generate project description file
- Create a web server to realize the communication between client and server
- Connect to the database and design the student information table according to the needs
- Create routes and implement page template rendering
- Implement static resource access
- Realize the function of adding student information
- Specify the request address and request method in the template form
- Add the name attribute for each form item
- Add routing to realize student information function
- Receive student information from the client
- Add student information to the database
- Redirect the page to the student information list page
- Realize student information display function
Required auxiliary files and modules
Generate package.json file to download mongoose module
Download router module
Function: Realize the use of routing
Steps:
1. Obtain routing object
2. Create a route by calling the method provided by the route object
3. Enable routing, make routing effective
Download the third-party module serve-staitc
Function: realize static resource access service
Steps:
1. Introduce the serve-static module to obtain the method of creating static resource service function
2. 2. Call the method to create a static resource service and specify the static resource service directory
3. Enable static resource service function
Download the DATE_FORMAT() function
Used to display date/time data in different formats.
We use NOW() to get the current date/time:
DATE_FORMAT(NOW(),'%b %d %Y %h:%i %p')
DATE_FORMAT(NOW(),'%m-%d-%Y')
DATE_FORMAT(NOW(),'%d %b %y')
DATE_FORMAT(NOW(),'%d %b %Y %T:%f')
The result is similar:
Dec 29 2008 11:45 PM
12-29-2008
29 Dec 08
29 Dec 2008 16:25:46.635
Self-motivation
Say okay to yourself that you can cry very embarrassed when you are sad, and when your tears drain, you should raise your head and smile beautifully.