Summer of Tech

View Original

Bootcamp Highlights: Building a Backend API

Written by Connor MattsonFollowing his talk on JavaScript 101, a week earlier, Justin Vos returned to the University of Auckland for “Building a Backend API.” A backend is something separated from the frontend of an application which provides both security and a single source of truth. This can be in the form of a peer-to-peer backend, like Bluetooth or bitcoin, or closer to the traditional client/server relationship.The frontend of an application talks to servers using an API. The most common style of API is a representational state transfer (REST) API. RESTful services often use HTTP methods and Justin began by showing how we can all use GET requests to easily make use of the Giphy API. For those of us attending the create camps this was extremely useful as many teams will be making use of APIs. We then dived into how we can create our own APIs.Using a simple web page with a single input, Justin walked us through developing an API that allows users to view comments and add their own. As the web page loads, a GET request retrieves previous comments and displays them to the user. Next, when the user types in their own comment, a POST request submits this back to the server and updates what the user sees.In addition to this, Justin discussed key concepts around development. This included CORS, JSON, databases, and an introduction to Node JS. To have a go at building your own API, take a look at https://github.com/justinvos/backend101.