Coding Notes
user

Coding Notes

In these coding notes I'm sharing my learning experiences and things that usually took time to understand and I hope they'll help you save some of your time. Enjoy! (All articles are released under a Creative Commons BY-NC license)


Node.js Docker MongoDB

Dockerizing a Node.js and MongoDB App

A lightweight approach with Alpine Linux

Docker has become an extremely popular tool not only among DevOps and Infrastructure people, but also for the daily work of any developer. And as a developer, during the past week I decided it was time to have a look at it and see by myself all the good things people talk about. And I don’t regret it! In a matter of days I could understand the basics (the very basics) and get up and running with what I mostly do these days, a Node.js and MongoDB application.

...
Creative Commons License

Node.js RESTful ApiDoc

Building a Node.js REST API (Bonus Track)

API Documentation

Having a good API documentation is crucial to let the clients understand how our API behaves and what does it expect form every request. We’ll see in this post how can we introduce into our Gulp build pipeline the generation of an API docs static website with the help of a library called apidoc. ...

Creative Commons License

ElasticSearch MongoDB

Indexing MongoDB with ElasticSearch

A simple autocomplete index project

Nowadays it’s very common to have a search feature in any website or app. This usually happens with platforms that have lots of information to offer to their users. From e-commerce websites which have thousands of products in different categories, to blogs or news sites which have thousands of articles. ...

Creative Commons License

Node.js RESTful UnitTesting

Building a Node.js REST API 8

Unit Testing

This is the last post of the series, and we’ll add some unit tests to the API we’ve built. It’s always important to have unit tests, because if in the future we do any kind of changes to the API code, we can quickly check if all the responses are still as expected or not. We can also check with unit tests what will happen when errors occur and see if the error responses are correct as well. ...

Creative Commons License

Node.js RESTful Express Joi

Building a Node.js REST API 7

Request Validation

We have now a set of endpoints to manage users and tasks, and secured with JWT to avoid unknown clients to access our API. Now we’ll have a look at how can we add some validation to the request payload sent by clients. Since we want to keep our database consistent, it’s good to check what the user is sending us. You can do validations in different levels. In the top level, you can validate data types and format of parameters, and in the next level you can validate that a resource ID sent by the user exists in the database. ...

Creative Commons License