TGIMBA NodeJS – Part 11

Git Hub Code

NOTE: The API Git repository got scrambled and I had to start over.  The link above is correct.

On this blog post, I want to demonstrate a couple of things – separate files for routes and updating the Dynamo Db calls to have the arguments in the HTTP call and not embedded in the route method.

The ’78af8d29e1bc168e7212d11870e42cf767bd37fe’ commit (done a few days ago) updates the code to have separate route files. I read a lot on how to do this and the best source I have found is video from tjholowaychuk (see reference #4). Simple and to the point 🙂

The ‘b81e65eb1f54f4dab69797d7de067b5da0554ad2’ commit (done today) removes the embedded variables from the Dynamo Db calls and replaces them with HTTP parameters.  Nothing really startling here other than I started using more specific and accurate HTTP verbs 🙂  Reviewing the SQL Server calls again, I think I will change these to be a more specific HTTP verb based on the all type.

Something I noticed when I went to add the Dynamo Db calls to the tests contained in the  TGIMBA Node .NET core project ( – I could not get the HttpClient .DeleteAsync() method to work with a body parameter like I did below using Postman (the best tool ever!).

The .PutAsync fell right into line and I have already been using the .GetAsync method for quite a while.  I found a couple of posts where folks used a URL parameter approach.  However, I also read some articles where others seemed to think this violated being ‘restful’.  I am going with the later and will eventually figure out how to implement the Postman delete call using a body parameter in .NET 🙂

One other peculiarity was that the Id is supposed to be a number.  When I added the body for the .PutAsync(args) method, they all had to be strings.  I would have thought that a new KeyValuePair<string, int>(“BucketListItemId”, 1) would have worked.  It didn’t, but even more fascinating, it showed up correctly in Dynamo db.

var content = new[]
new KeyValuePair<string, string>(“Achieved”, “false”),
//TODO – figure out how to make this an int that compiles
new KeyValuePair<string, string>(“BucketListItemId”, “1”),
new KeyValuePair<string, string>(“Category”, “Hot”),
new KeyValuePair<string, string>(“CategorySortOrder”, “1”),
new KeyValuePair<string, string>(“Created”, “2015-09-14 00:00:00.000”),
new KeyValuePair<string, string>(“ListItemName”, “Fly to the moon”)







Stay tuned!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s