A little code reorganization + other small changes

- in app.js rename "content-type" to "Content-Type";
- add more console.log calls for easier debugging.