Project based onexpress
+sequelize
+mysql
+express-validator
Based on the node+express crawler API interface project, including national college information, idioms and poems, horoscope, historical today, music data interface, picture wallpaper, funny video, hot news information details interface data
Project address: https://github.com/ecitlm/Node-SpliderApi.git
- [x]
express
as the base frame - [x]
sequelize
Operate mysql - [x]
mysql
store data - [x]
express-validator
Parameter form validation - [x] Use
cheerio
to parse the crawler page - [x] integrated
ejs
template - [x] integration
swaggerUI
interface documentation - [x]
nodemon
Project development dynamic hot update - [x]
dotenv
Manage configuration system parameters - [x] Contains interface sign request verification
- [x]
log4js
Error log collection
Environmental requirements
Need to installnode
environment,mysql
database
Deploy and run
$ git clone https://github.com/ecitlm/Node-SpliderApi.git
$ npm install
# start project dev
$ npm run dev
# starting prd
$ npm run prd
#localhost:3001
Server deployment
Usepm2
in the server to process thenode
service
#启动进程/应用
pm2 start npm --watch --name tools -- run prd
pm2 restart tools
pm2 stop tools
pm2 delete tools
database
mysql
Contains, Tang poetry 300, idioms, today's history, horoscope (aggregate platform data - need to apply for your own APPCODE), user table and other data project directorybak-file
folder can be viewed
interface documentation
After starting the projecthttp://localhost:3001/api-docs/
can view the interface documentation page,
Error code description
status code | meaning | Remark |
---|---|---|
200 | normal response | |
1001 | The parameter is invalid, such as a non-existing id | |
1002 | The parameter is empty, the validation fails, the parameter type is wrong | |
1003 | The request signature is abnormal and illegal | |
404 | request does not exist | |
405 | wrong request method | |
9999 | Third-party interface request exception | |
500 | System exception |
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。