How to add an additional endpoint to the AWS Amplify Express Server?

爷,独闯天下 提交于 2020-03-28 06:41:51

问题


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});
});

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.

What is the correct way to add more REST endpoints? I have a feeling that I'm missing some additional configuration step.


回答1:


After deploy the API and function, to add additional path you should use "amplify update api"



来源:https://stackoverflow.com/questions/60292679/how-to-add-an-additional-endpoint-to-the-aws-amplify-express-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!