Skip to content

Commit

Permalink
fix(cognito): docs compile and improved (#171)
Browse files Browse the repository at this point in the history
Improved the readme examples and now they compile and run successfully.
  • Loading branch information
staycoolcall911 authored Apr 1, 2024
1 parent 602972b commit 466bacc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions cognito/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ npm i @winglibs/cognito
## Usage

```js
bring cloud;
bring cognito;

let api = new cloud.Api();
Expand All @@ -33,13 +34,17 @@ auth.get("/hello");
### Wing Code

```js
auth.signUp("[email protected]", "This-is-my-test-99!");
auth.adminConfirmUser("[email protected]");
let token = auth.initiateAuth("[email protected]", "This-is-my-test-99!");
let res = http.get("{api.url}/hello", headers: {
"Authorization": "Bearer {token}"
});
expect.equal(res.status, 200);
bring expect;
bring http;
test "auth happy path" {
auth.signUp("[email protected]", "This-is-my-test-99!");
auth.adminConfirmUser("[email protected]");
let token = auth.initiateAuth("[email protected]", "This-is-my-test-99!");
let res = http.get("{api.url}/hello", headers: {
"Authorization": "Bearer {token}"
});
expect.equal(res.status, 200);
}
```

### AWS CLI
Expand Down
2 changes: 1 addition & 1 deletion cognito/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@winglibs/cognito",
"version": "0.0.4",
"version": "0.0.5",
"description": "A wing library to work with AWS Cognito",
"author": {
"name": "Elad Cohen",
Expand Down

0 comments on commit 466bacc

Please sign in to comment.