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
Install Packages:
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
Set-up Database:
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.
Set-up routes:
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
Link: https://www.yelp.com/biz/coriander-gourmet-thai-san-francisco
La Briciola Ristorante Italiano
Link: https://www.yelp.com/biz/la-briciola-san-francisco?osq=La+Briciola+Ristorante+Italiano
AK Subs
Link: https://www.yelp.com/biz/ak-subs-san-francisco
Pho 2000
Link: https://www.yelp.com/biz_photos/pho-2000-san-francisco