/* express的服务器 */ // 1. 导入express const express = require('express');
const bodyParser = require('body-parser');
// 2. js文件导入 const aesEncrypt = require("路径");
// 3.创建express服务 const app = express();
const server = require('http').createServer(app);
app.use(bodyParser.urlencoded({ extended: true }));
// 4.访问服务器 app.get('/', (req, res) => { console.log(req.body) // 输出python请求参数 const result_1 = aesEncrypt("待加密字段"); console.log(result_1) res.send(result_1); // NodeJS返回加密值 });
app.post('/', (req, res) => { console.log(req.body) // 输出python请求参数 const result_2 = aesEncrypt("待加密字段"); console.log(result_2) res.send(result_2); // NodeJS返回加密值 });
// 5.绑定端口 const port = 3000;
server.listen(port);
标签:node,const,log,res,app,express,----,result From: https://www.cnblogs.com/modly/p/16842555.html