Search code examples
javascriptamazon-web-servicesrestexpressaws-amplify

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


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.


Solution

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