Skip to content

Commit 091d03d

Browse files
authored
Merge pull request #12 from Moesif/update-readme-about-aws-api-gateway
Update readme about API gateway
2 parents 2ad5285 + ca9b5bd commit 091d03d

File tree

1 file changed

+29
-22
lines changed

1 file changed

+29
-22
lines changed

README.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
[![Software License][ico-license]][link-license]
77
[![Source Code][ico-source]][link-source]
88

9-
Node.js Middleware for AWS Lambda that automatically logs API calls
10-
and sends to [Moesif](https://www.moesif.com) for API analytics and monitoring.
9+
Node.js Middleware for AWS Lambda that automatically logs API calls
10+
and sends to [Moesif](https://www.moesif.com) for API analytics and monitoring.
1111

1212
Designed for APIs that are hosted on AWS Lambda using Amazon API Gateway or Application Load Balancer
13-
as a trigger. Works with REST APIs, GraphQL APIs (such as with apollo-server-lambda) and more.
13+
as a trigger. Works with REST APIs, GraphQL APIs (such as with apollo-server-lambda) and more.
1414

1515
[Source Code on GitHub](https://github.com/moesif/moesif-aws-lambda-nodejs)
1616

@@ -20,8 +20,8 @@ as a trigger. Works with REST APIs, GraphQL APIs (such as with apollo-server-lam
2020
</h4>
2121
<br>
2222
<p>
23-
Alternatively, if you're running the Node.js Express Framework on AWS Lambda and prefer to not have any AWS specific dependencies,
24-
Moesif has <a href="https://www.moesif.com/docs/server-integration/nodejs/">Express Middleware</a> also available.
23+
Alternatively, if you're running the Node.js Express Framework on AWS Lambda and prefer to not have any AWS specific dependencies,
24+
Moesif has <a href="https://www.moesif.com/docs/server-integration/nodejs/">Express Middleware</a> also available.
2525
However, moesif-nodejs won't capture lambda specific context like Trace Id.
2626
</p>
2727
</div>
@@ -73,12 +73,19 @@ exports.handler = moesif(moesifOptions, exports.handler);
7373

7474
### 2. Enter Moesif Application Id
7575
Your Moesif Application Id can be found in the [_Moesif Portal_](https://www.moesif.com/).
76-
After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.
76+
After signing up for a Moesif account, your Moesif Application Id will be displayed during the onboarding steps.
7777

78-
You can always find your Moesif Application Id at any time by logging
78+
You can always find your Moesif Application Id at any time by logging
7979
into the [_Moesif Portal_](https://www.moesif.com/), click on the top right menu,
8080
and then clicking _Installation_.
8181

82+
### 3. Trigger your API
83+
84+
Grab the URL to your API Gateway or LB and make some calls using a tool like Postman or CURL.
85+
86+
> In order for your event to log to Moesif, you must test using the Amazon API Gateway trigger. Do not invoke your lambda directly using AWS Console as the payload won't contain a valid HTTP payload.
87+
88+
8289
## Repo file structure
8390

8491
- `lib/index.js` the middleware lib
@@ -111,10 +118,10 @@ options.identifyUser = function (event, context) {
111118

112119
Type: `(event, context) => String`
113120
identifyCompany is a function that takes AWS lambda `event` and `context` objects as arguments
114-
and returns a companyId. If your business is B2B, this enables Moesif to attribute
115-
API requests to specific companies or organizations so you can understand which accounts are
116-
calling your API. This can be used simultaneously with `identifyUser` to track both
117-
individual customers and the companies their a part of.
121+
and returns a companyId. If your business is B2B, this enables Moesif to attribute
122+
API requests to specific companies or organizations so you can understand which accounts are
123+
calling your API. This can be used simultaneously with `identifyUser` to track both
124+
individual customers and the companies their a part of.
118125

119126

120127
```javascript
@@ -261,7 +268,7 @@ options.maskContent = function(moesifEvent) {
261268

262269
#### __`debug`__
263270
Type: `Boolean`
264-
Set to true to print debug logs if you're having integration issues.
271+
Set to true to print debug logs if you're having integration issues.
265272

266273
For more documentation regarding what fields and meaning,
267274
see below or the [Moesif Node API Documentation](https://www.moesif.com/docs/api?javascript).
@@ -339,7 +346,7 @@ var user = {
339346
companyId: '67890', // If set, associate user with a company object
340347
campaign: {
341348
utmSource: 'google',
342-
utmMedium: 'cpc',
349+
utmMedium: 'cpc',
343350
utmCampaign: 'adwords',
344351
utmTerm: 'api+tooling',
345352
utmContent: 'landing'
@@ -361,7 +368,7 @@ moesifMiddleware.updateUser(user, callback);
361368
```
362369

363370
## Update Users in Batch
364-
Similar to updateUser, but used to update a list of users in one batch.
371+
Similar to updateUser, but used to update a list of users in one batch.
365372
Only the `userId` field is required.
366373
This method is a convenient helper that calls the Moesif API lib.
367374
For details, visit the [Node.js API Reference](https://www.moesif.com/docs/api?javascript--nodejs#update-users-in-batch).
@@ -378,7 +385,7 @@ var user = {
378385
companyId: '67890', // If set, associate user with a company object
379386
campaign: {
380387
utmSource: 'google',
381-
utmMedium: 'cpc',
388+
utmMedium: 'cpc',
382389
utmCampaign: 'adwords',
383390
utmTerm: 'api+tooling',
384391
utmContent: 'landing'
@@ -419,10 +426,10 @@ var moesifMiddleware = moesif(options);
419426
// metadata can be any custom object
420427
var company = {
421428
companyId: '67890',
422-
companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info
423-
campaign: {
429+
companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info
430+
campaign: {
424431
utmSource: 'google',
425-
utmMedium: 'cpc',
432+
utmMedium: 'cpc',
426433
utmCampaign: 'adwords',
427434
utmTerm: 'api+tooling',
428435
utmContent: 'landing'
@@ -443,7 +450,7 @@ moesifMiddleware.updateCompany(company, callback);
443450
```
444451

445452
## Update Companies in Batch
446-
Similar to updateCompany, but used to update a list of companies in one batch.
453+
Similar to updateCompany, but used to update a list of companies in one batch.
447454
Only the `companyId` field is required.
448455
This method is a convenient helper that calls the Moesif API lib.
449456
For details, visit the [Node.js API Reference](https://www.moesif.com/docs/api?javascript--nodejs#update-companies-in-batch).
@@ -457,10 +464,10 @@ var moesifMiddleware = moesif(options);
457464
// metadata can be any custom object
458465
var company = {
459466
companyId: '67890',
460-
companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info
461-
campaign: {
467+
companyDomain: 'acmeinc.com', // If domain is set, Moesif will enrich your profiles with publicly available info
468+
campaign: {
462469
utmSource: 'google',
463-
utmMedium: 'cpc',
470+
utmMedium: 'cpc',
464471
utmCampaign: 'adwords',
465472
utmTerm: 'api+tooling',
466473
utmContent: 'landing'

0 commit comments

Comments
 (0)