Starting with Vagrant, Node JS, Express, Mondo DB, Heroku
I want to share with you a project of mine. I maked this to learn and maybe it can help you.
You can see the full tutorial and demo here: https://github.com/fernandoperigolo/nodejs-crud
The tips
After do my little API, what i learned is:
Use Vagrant as possible. You win total control about your ambient without broke or slow your machine. If something go wrong, just destroy Vagrant VM and
vagrant up
again;We need a lot of cli apps, pump your console. Install iTerm or Console2. Study then and extract the best;
Heroku is a great tool. I do not fight with server;
Git is the thing who make modern development works. You need to be very close of it;
Crossdomain sucks. To test your API, you need to enable cross domain, something like this:
// Enabling Cross Domain
app.all('*', function(req, res, next) {
res.header('Access-Control-Allow-Origin', '*');
res.header('Access-Control-Allow-Methods', 'PUT, GET, POST, DELETE, OPTIONS');
res.header('Access-Control-Allow-Headers', 'Content-Type');
next();
});
- I like to use RESTClient(https://addons.mozilla.org/pt-br/firefox/addon/restclient/) to test my API, but remember to set the call headers to
Content-Type: application/json
;
Written by Luiz Fernando de Souza Filho
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Heroku
Authors
Filed Under
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#