API 网关
const express = require('express')
const httpProxy = require('express-http-proxy')
const app = express()
const userServiceProxy = httpProxy('https://user-service')
// 身份认证
app.use((req, res, next) => {
// TODO: 身份认证逻辑
next()
})
// 代理请求
app.get('/users/:userId', (req, res, next) => {
userServiceProxy(req, res, next)
})最后更新于