Saturday, April 8, 2017

MERN Series Step 2 - MongoDB and yomern

MongoDB installation guide is located here: https://docs.mongodb.com/v3.0/installation/. I am a big fan of chocolatey, so I'll be using chocolatey command line to install it: choco install -y mongodb.

Some handy mongodb commands:
https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-windows/#run-mongodb

I'm using tech-dojo's MERN framework, read the docs on tech-dojo's page as there is more to it than just the generator, they have a starter in github:
git clone https://github.com/tech-dojo/mern

The starter app uses mocha/chai/sinon stack for testing, which I prefer over Jasmine/Karma. Once installed, verify the app is working by running gulp serve
Run the unit tests using gulp test. I had one user test fail, but everything else passed.

Choosing a generator/starter project is mainly governed by what you want to use in the project. There are several options out there for MERN type stacks, I chose tech-dojo's because it uses the testing stack I'm interested in, as well as using express and mongodb. Some other options that looked promising:
  • mern-cli from http://mern.io for scaffolding and code generation 
  • Accelerate looks like it might be interesting , but appears to be more than just a generator, I may look at it in detail later. 
  • You could probably also get away with using parts of angular-fullstack generator, but that seems like wasting its potential. If you're going with MEAN stack it's definitely the way to go. 
  • Fountain-webapp also look like it could be good, it's using Karma for testing 
  • Last one I'll list, react-fullstack look very popular, but hasn't been updated in a year. 
This process leaves you with both client and server side set up, so I'll need to look at what's in this client vs what I set up using yo webapp in the previous article. I know I don't like currently having both the client and server in the same git repo, and the tests for both client and server are in the tests folder instead of separated. This makes it more difficult to rev them independently. I'll likely at least be splitting the repo into two and split the tests.

I also noticed a number of deprecated packages during the npm install, I will investigate updating all of these after I get the base scaffolding done.

It looks like the yomern yeoman generator is for creating components of functionality, which seems like it would be quite useful to eliminate boilerplate

No comments:

Post a Comment