I’ve been exploring MongoDB because we were supposed to be starting an
engagement with a client that is pretty heavily invested in using it. And while
that project was going to be primarily node.js, I wanted to also explore the
ecosystem’s compatibility with .NET. In my experience, C# and MongoDB worked
pretty well together.

I searched all over and found only a few out of date examples for setting up
the MongoDB driver to log queries and only found small hints in the comments of
StackOverflow questions or references to older versions that don’t apply
anymore.

While that project is using Angular2, everything discussed here applies
to React or Angular 1.x or any other FE framework you might be using, as
long as it builds with webpack.

In fact, not too much here is even webpack specific. It could work easily
with any FE framework or tooling that provides some sort of “serve” command
that compiles and hosts assets during development time, such as ember serve
or the http-server npm package.

Note: this approach makes sense for projects where you want to mix server side
razor rendering and javascript rendering. For example, perhaps some of the
shell of your site is rendered serverside, but the SPA framework only controls a
big ol’ div in the center of the page. If the entire app is driven from the client
side, you can use webpack-dev-server’s proxy feature to proxy to the API endpoints

I’ve been playing with angular 2 this week and I think I like it. Angular
2 apps are structured a good bit differently than Angular 1.x, but I’m
finding it to be pretty flexible and easy to use once you get it up and
running.