如何将其他终端节点添加到AWS Amplify Express Server? [英] How to add an additional endpoint to the AWS Amplify Express Server?
问题描述
我已经使用Amplify生成了REST Express服务器.
I've generated an REST express server with Amplify.
我尝试向其添加更多端点:
I tried adding to more endpoints to it:
// using serverless express
app.post('/myendpoint', function(req, res) {
console.log('body: ', req.body)
res.json(req.body)
});
// using serverless express
app.get('/myendpoint', function(req, res) {
res.json({success: 'get call to my endpoint succeed!', url: req.url});
});
运行amplify push
后,我在控制台中看不到这些端点,也无法通过amplify向它们发出请求.
After running amplify push
I don't see these endpoints in the console, and I can't make requests to them via amplify.
作为初始配置工作的一部分生成的端点.
The endpoints that were generated as part of the initial configuration work.
添加更多REST端点的正确方法是什么?我觉得我缺少一些额外的配置步骤.
What is the correct way to add more REST endpoints? I have a feeling that I'm missing some additional configuration step.
推荐答案
部署API和功能后,要添加其他路径,您应该使用放大更新api"
After deploy the API and function, to add additional path you should use "amplify update api"
这篇关于如何将其他终端节点添加到AWS Amplify Express Server?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!