Skip to content

Latest commit

 

History

History
79 lines (45 loc) · 2.46 KB

README.md

File metadata and controls

79 lines (45 loc) · 2.46 KB

Task 1 - Your first API

Objectives

  • Learn how server programming works and create your first get and post API.

Learning Resources

These resources are exactly the one in the Precourse Learning Resources. Our aim for this week is to be thorough with these concepts first and apply them on the task mentioned below.

Topic Resource
HTML and CSS Link to this resource
JavaScript for beginners Link to this resource
Serverside Programming with NodeJS Link to this resource
Algorithms Link to this resource
PostgreSQL Link to this resource

Tasks

Step 1: Create a new NodeJS Project with Express.

  • Create a git repo on your GitHub account.
  • Create a simple NodeJS project.
  • Install express with NPM.
  • Run the project, and make sure everything looks okay.
  • If you have questions on any of these steps. Please google them out.

Step 2: Your First API.

Today, you'll be creating your first GET and POST API's. If you don't know what they are. Please checkout this video..

  • Create a GET API. This is a very simple API and returns {status: success} as response.
Request Type: GET
Route: /
Response: {status: success}
  • Create a POST API. POST API's are used to save data on the server. Take a request payload {data: 'Any String'}. Create a variable that's outside API scope and save the data there, once you're done doing that return the same data in the request.
Request Type: POST
Route: /data
Request: {data: 'Any String'}
Response: {data: 'Any String'}
  • Create a GET API. This GET API will be used to get the data that you've saved before with POST.
Request Type: GET
Route: /data
Response: {data: 'Any String'}

There are a lot of resources on Google on how to build API's with express. Please google these resources if you're stuck.

Step 3: Push your changes to Git

Push all your changes to your GitHub Repo.

Deliverable

Please submit your GitHub Repo to your mentor as soon as you're done, so he or she can review.