Codewars 4

I moved to 4th kyu this week.


  • If it takes me less than hour to complete 5th level task, 4th tasks take couple hours and 3rd level tasks several days.
  • One can repeat the same task in a different language (since C# and JS are very different it’s not a simple syntax change). When completing the same task in different language the overall rank does not change, but rank in individual language increases:

Screen Shot 2017-09-25 at 6.39.28 PM


C# vs JS

After getting to 5th kuy in Codewars using Javascript I decided to do the same with C#. It took me a couple days, but I one thing I noticed is that code in C# is significantly longer than in JS. Although it is fun working on algorithms, it is not fun to code every single line anymore. I found out I am having way more fun when working in JS (surprise, surprise) than in C#. I never thought that I would say this, but with introduction of ES6 JS is my favorite language now.


Interesting site with fun coding exercises: Codewars

You start with 8th kyu (white belt) and need to complete 4 or 5 katas to move to the next kyu. I spent couple days to move to 5th kyu by completing 17 katas.

codewars screenshot

Besides having fun coding I found out that the same problem (even very small and trivial) can be solved in literally thousands of ways. Some of the solutions were so cool, so I saved them in order to parse them later.

One more tip if you are playing with JS at Codewars: console.log() does not work when submitting Attempts. Use instead. I found this out when I couldn’t figure out why 3 of 60 test cases were failing. Codewars runs in the back and it does not give you incoming parameters for final test, so I had to trace them with


Found a very cool project:

I already started working on react native client for Mongo Explorer, but decided to check Expo first. I had another project I wanted to build – food ordering api, so I decided to build it with Expo. Here is the source:

The Expo experience is extremely positive. Very quickly I was able to build a simple mobile app and run it my phone (even without Apple developer license). I see how useful could be to use Expo when you working on UI/UX with the client. Developers can quickly build screens so customers can test them on their phones when developers share the link to the project.


When I started my MEAN path I thought that I will learn all technologies related. With Mongo-Explorer-API project I used 3 out of 4 technologies:

MongoDB (M)

Express.JS (E)

and Node.JS (N)

I was planning to continue with Angular 2 in the client project which supposed to connect the API. After some consideration I came to conclusion that I want to make a detour and instead of building a Web client project in Angular 2 (A) I will work on mobile client first using React Native (N).

So I am taking a detour with MERN. I am so excited!


Found out that examples in MongoDB use co generator to make it easier to write and read async functions:

Something very complicated (because of multiple callbacks) like:
var db = new Database('test', new Server(connectionString.server, connectionString.port));, db) {
if (err)
var adminDb = db.admin();
adminDb.listDatabases(function(err, dbs) {
if (err)
cb(null, dbFound);

becomes very simple when using co:

return co(function*() {
let db = yield MongoClient.connect(url, {ssl:connectionString.ssl});
let dbs = yield db.command({listDatabases:1});


I decide to post the Mongo Explorer API project to Heroku.

Here is what had to do:

  1. Create an account on Heroku
  2. Installed Heroku Command Line Interface (CLI) with homebrew:
     brew install Heroku
  3. Logger on to Heroku:
     heroku login
  4. Created an app:
    heroku create
  5. Deploy the code:
    git push heroku master
  6. Obviously, the app crashed and did not run, so I had to check the logs:
    heroku logs --tail

It took me couple hours to figure out how to prepare my project to run on Heroku:

  1. I had to add start script in package.json. Heroku uses Procfile, but if file is not found then it looks for start script:
    “scripts”: {
    “start”: “node app.js”
  2. Heroku assigns port dynamically, so I had to change startup code from: app.listen(config.get(‘NODE_PORT’));
    var port = process.env.PORT || config.get('NODE_PORT');
  3. Now the app started, but Swagger UI was failing so I had do the last change: in swaggerDefinition variable I had to change
    host from localhost:4000 to
  4. The last thing was adding CORS support.

And now my app runs on:



Time to add some UI.

Fortunately, I know pretty easy and cool way to visualize API – my old friend Swagger. I used Swagger in one of my projects in ASP.NET and decided to use it for my Node.JS project. I found pretty good article on adding Swagger support:

Just committed first basic Swagger description in my project: which will be accessible from http://localhost:4000/api-docs/