7
Project based on express + 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 install node 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

Use pm2 in the server to process the node 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 directory bak-file folder can be viewed

interface documentation

After starting the project http://localhost:3001/api-docs/ can view the interface documentation page,
api.png
api2.png

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

coding
257 声望14 粉丝

hello world