Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add got4aws to AWS section #1380

Merged
merged 1 commit into from
Jul 28, 2020
Merged

Add got4aws to AWS section #1380

merged 1 commit into from
Jul 28, 2020

Conversation

SamVerschueren
Copy link
Contributor

As discussed, I replaced the code in the AWS section with got4aws because the code wasn't working either.

Feel free to let me know if you want to rephrase some other things as well.

@szmarczak
Copy link
Collaborator

An example on how to make a request w/ credentials would be great :)

@SamVerschueren
Copy link
Contributor Author

You mean something like I do in the got4aws example itself?

import got4aws from 'got4aws';

// Load credentials from `~/.aws/credentials`
const got = got4aws({
	providers: new AWS.SharedIniFileCredentials({profile: 'myProfile'})
});

(async () => {
	const {body} = await got.get('https://12abc34.execute-api.us-east-1.amazonaws.com/v0');

	console.log(body);
	//=> {status: 'ok'}
})();

@SamVerschueren
Copy link
Contributor Author

But then without TS and the IIFE.


const response = await awsClient('endpoint/path', {
const response = await awsClient('https://<api-id>.execute-api.<api-region>.amazonaws.com/<stage>/endpoint/path', {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it clear enough to the user that they need to fill in <api-id> with their own value?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess so. If anyone finds this hard then he may create an issue and we'll fix that :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could easily change it to a real URL like I do in the docs of got4aws itself. If you are familiar with API Gateway, I believe you definitely know how this works. I just copy-pasted it from the example which was already present in the docs before.

@szmarczak szmarczak merged commit ddd7930 into sindresorhus:master Jul 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants