nodeJS搭建HTTP服务器 发表于 2022-03-16 | 分类于 python爬虫 npm i express 1234567891011121314151617181920212223242526272829const CryptoJS = require('./crypto.js')const express = require('express')const app = express()const port = 3000app.use(express.json())function getToken(player) { let key = CryptoJS.enc.Utf8.parse("fipFfVsZsTda94hJNKJfLoaqyqMZFFimwLt"); const {name, birthday, height, weight} = player; let base64Name = CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(name)); let encrypted = CryptoJS.DES.encrypt( `${base64Name}${birthday}${height}${weight}`, key, { mode: CryptoJS.mode.ECB, padding: CryptoJS.pad.Pkcs7, } ); return encrypted.toString();}app.post("/", (req, res) => { const data = req.body res.send(getToken(data)) })app.listen(port, () => {}) 123456789101112import requestsitem = { 'name': '凯文-杜兰特', 'image': 'durant.png', 'birthday': '1988-09-29', 'height': '208cm', 'weight': '108.9KG'}response = requests.post('http://localhost:3000', json=item)print(response.text) 赏个🍗吧 打赏 微信支付 支付宝 本文作者: Keeep 本文链接: http://Keeep.coding.me/blog/nodeJS搭建HTTP服务器/ 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!