0

Is it possible to access the aws api gateway in aws SAM local with a webpage? at the moment I have everything running local (amazon DynamoDB, (aws lambda, aws api gateway with aws sam local)) but I can't access the api's with a ajax call because I have no rights is there an option to give it rights or disable the rights so I can test my real ajax calls?

update1: solved the CORS prob with an addon for chrome that enables it all the time for itself but now i can see my output in the previeuw in the developer options of chrome (F12) but i still get a 502 bad gateway, any idea why this is?

update2: okay solved that problem to, but now i want to do a post from my webpage true my api gateway true my lambda to my DynamoDB i know i can use the event in the lambda exports.post = (event, context, callback) but it is just plain empty in the body so i cannot get anything in it so i can't get anything out of it. the curl statement i use: curl -d '{"id": 8}' http://127.0.0.1:3000/resource i can just see: body: '\'{id:', as you can see no 8 in it to use. anybody got any answer or work around?

many thanks Liam

4

1 回答 1

0

i found out the problem was that i had: contentType: "application/json; charset=utf-8", and dataType: "json", in my ajax call removed those and everything works fine.

于 2017-09-26T07:16:50.663 回答