This past week, I was setting up a Node.js backend for the first time and fell into a rabbit hole while researching the organizational development options. Enter Git Hooks—these allow the user to run custom scripts whenever a specified git event occurs. You can write the hooks in any language you’d like and you can even view example scripts that git installs when you
git init your project directory. Navigate to
.git/hooks to check them out.
var like so
var x = 10
This makes sense
var meaning variable is equal to
10. So why do we have to use
const? Well the problem lies with how the variable is scoped. Variables declared with
var can be reassigned and can be hoisted or declared before they actually occur from top to the bottom in your code.
Basically, you can never be too sure what the value of your variable is going to be if you are not extra…
Procs and Lambdas are both used similarly but are different in a particular way. Both are higher order functions which are functions that take other functions as parameters or returns them as a result. Breaking that down further a block is a nameless method that is passed to another method as a parameter.
Blocks cannot be saved as variables. They are one of the few instances in which the ruby “everything is an object” rule is not true.
Procs are blocks of code that can be bound to a set of local variables. …
First we need to download the MongoDB community server. Make sure to pick the right download for your operating system and then follow the instructions to install and get it running on your system on your system. MongoDB community server is completely free for anyone to use!
In Ruby on Rails we can use the ActiveStorage gem to upload files to your database. Although it takes a little getting used to, it allows you to rather simply upload an image and (in my case) save it in an AWS S3 bucket, then saves the S3 url as in a table as a blob with another table that references it’s placement in the blog table.
So how do we do this in Node.js?
That has what I’ve been researching currently and there seem to be two popular approaches.
Approach one is to use install the above packages which…
On the last tutorial we created a very basic ‘Hello World’ implementation of Express.js. In this part of the series we will create a Model, Router and Controller. With the goal of creating a Movie lookup API.
Ok now we are ready to go, first lets install
body-parser. Although we have a very simple server thus far, as we start adding requests to and from
body-parser will make our lives much easier. …
TypeScript allows us to write error proof code by specifying which type the variables we write are. This makes it easier for anyone new to the codebase you are working on to understand what data type is going where.
The most basic data types are
String type is mean for a sequence of one or more characters that may consist of letters, numbers, or symbols.
This will be a quick run through how to setup basic Express API server.
Go ahead and create a new directory and open it in your IDE. Initiate the project with npm with the following command
$ npm init -y
This will setup your package.json file with all the default values. If you wish to go through the prompt to fill out all the fields manually just remove the
Alright lets get to work. First, lets install express.
$ npm i express
Since we are using TypeScript lets add it to the project as well as the types…
I’m currently in the process of taking what I learned from the Flatiron School’s Software Engineering program and building upon it. Right now, I’m focusing on learning how to make a backend API using Node.js and also giving noSQL databases a go. Welcome MongoDB.
We all need documentation to understand how a new API works, and nothing turns me away faster from learning something new than poorly presented documentation. Grammar or spelling aside (you should always do a double check!), here’s how to use a very basic and powerful, easy-to-use formatting language called Markdown.
Markdown is a markup language that’s meant to be easy to read and format. Its main source of inspiration is a plain old email. There aren’t a lot of features, but for a simple README file, it’s plenty. With these easy options you can create an inline html file for…