server.js 2.0 KB

12345678910111213141516171819202122232425
  1. let data = { "data": [{ "id": "1", "name": "\u4f01\u4e1a\u4f1a\u5458", "type_name": "MEMBER COMPANIES ", "type": "1", "level": "1", "logo": "", "project_reduction_rate": "2", "hire_reduction_rate": "2", "job_reduction_rate": "2", "max_buy_month": "24", "join_num": "0", "publish_num": "", "can_buy_monthly": "0", "can_buy_quarterly": "1", "can_buy_yearly": "0", "monthly_origin_price": "599", "monthly_real_price": "599", "quarterly_origin_price": "1797", "quarterly_real_price": "1798", "yearly_origin_price": "7188", "yearly_real_price": "7188", "create_time": "1545137223", "update_time": "1548034593", "is_month_discount": 0, "is_quarter_discount": 1, "is_year_discount": 0, "job_discount": "6.7", "project_discount": "8.6", "create_date": "2018-12-18", "update_date": "2019-01-21" }, { "id": "2", "name": "\u5f00\u53d1\u8005\u4f1a\u5458", "type_name": "DEVELOPER MEMBER", "type": "2", "level": "1", "logo": "", "project_reduction_rate": "1", "hire_reduction_rate": "1", "job_reduction_rate": "1", "max_buy_month": "24", "join_num": "0", "publish_num": "", "can_buy_monthly": "0", "can_buy_quarterly": "1", "can_buy_yearly": "0", "monthly_origin_price": "299", "monthly_real_price": "199", "quarterly_origin_price": "897", "quarterly_real_price": "448", "yearly_origin_price": "3588", "yearly_real_price": "1788", "create_time": "1545137223", "update_time": "1548034527", "is_month_discount": 1, "is_quarter_discount": 1, "is_year_discount": 1, "job_discount": "8.3", "project_discount": "8.0", "create_date": "2018-12-18", "update_date": "2019-01-21" }], "info": "\u64cd\u4f5c\u6210\u529f", "status": 1, "trackID": "1548064204.6727.51681" }
  2. const path = require('path')
  3. const express = require("express")
  4. const app = express()
  5. const port = 8080
  6. const host = '0.0.0.0'
  7. // 根路径
  8. app.get('/api/getList', (req, res) => {
  9. res.send(data)
  10. })
  11. app.post('/api/getList', (req, res) => {
  12. res.send(data)
  13. })
  14. // 启动服务
  15. app.listen(port, host, err => {
  16. if(err) console.log(err)
  17. else console.log(`run in http://${host}:${port}`)
  18. })