Horizons Week 3 - Backend Baby!
This week was an especially exciting week as I got to attend TechCrunch Disrupt SF AND I got to hear Vitalik Buterin and CO. speak twice...
So, I will split this post into two, allowing me to speak in more detail about my crypto adventures. So, if you are less interested in what I learned and what I ate and more interested in Vitalik Buterin, ignore this post and check out my next one.
What I Learned: Backend Basics
First off, NPM in itself is a reason to use Node. NPM, for those who are unfamiliar is the Node Package Manager. For almost anything you want to do, there is likely a package you can install. Here are a few of the packages we use to get a server up and running:
- Handlebars: used for templating, according to their website "minimal templating on steroids"
- Express: used for server
- Body-parser: needed for post requests on the server
- Express-validator: allows for validation server-side
- Nodemon: allows for the server to restart on every save/change of code VERY HELPFUL
- Mongoose: allows your server to easily connect to mongoDB
We used a service called mLab to host our MongoDB database. While you only get 0.5gb for free, this is great for hackathons, testing, and quick deployment.
Connect server and Database:
Connecting the server to the database is quite easy. We use a .sh file on the mac and gitignore to securely connect and hide our credentials when committing our code to GitHub.
Obviously the most important part of a server is setting up the routes. We have to deal with the different necessary database interactions required by the client. With express, this is very easy. You simply specify the method, the path, the server action, and the return message.
What I Ate
HUGE weekly upgrade: MealPal
Coriander Gourmet Thai
La Briciola Ristorante Italiano