Skip to content

REST API that allows users to create, edit, view or delete an online post on an Online Forum. Utilized AWS Lambda.

Notifications You must be signed in to change notification settings

m339kim/OnlineForum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Online Forum API

Overview

Screen Shot 2022-05-16 at 8 03 49 PM

The Online Forum API is a REST API created using AWS Lambda that allows users to easily create, edit, view or delete an online post on an Online Forum. The data or commands users send are stored on an online database, so that the information can be accessed via internect connection.

Tools Utilized

This RESTful API is fully written in JavaScript. It is built using AWS API Gateway and AWS Lambda, with a MongoDB backend server; enabling information to be stored persistently in an online database. A Mongoose layer was installed and added to the API to configure the database connection. For testing purposes, a Google Chrome Extension Talend API Tester and the API testing environment on AWS was used. Further demonstrations will be in this documentation!

How does it operate?

There are essentially four actions the user can take: Create a post, Edit a post, View a post (either view all posts or view a specific one), and Delete a post.

  1. Create a post case: 'POST'
    First, let's create a post. To do so, we must fill out the required information, which in this case is the name of the author, the content of the post, and the user-spcified password of the post. These information need to be in the Request Body, in JSON format. So, for instance, if we wish to add a post Minjae created that says Hello World! with the password minjae123, the following needs to be sent to be sent as the Request Body:
{
  "name": "Minjae",
  "content": "Hello World!",
  "password": "minjae123"
}

Screen Shot 2022-05-16 at 9 19 57 PM

We can see that the post has beed added to the MongoDB database:

Screen Shot 2022-05-16 at 9 28 59 PM


As simple as that!
  1. Edit a post case: 'PUT'
    To edit a post, we need a user-specified password for that post. We send this password as a Header along with the updated post information in the Request Body, similarly as we did to Create a post. Let's update the content body of our post to "Content updated":

Screen Shot 2022-05-16 at 9 35 16 PM


Success! We can see the changes in our database as well:

Screen Shot 2022-05-16 at 9 40 42 PM


  1. View a post (View all post or a Specific post) case: 'GET'
    When we wish to view all of the posts, then we can use the GET method to access them. The run results of the method is:

Screen Shot 2022-05-16 at 9 42 46 PM


Now, if we wish to view a specific post, then we can add a forward slash (/) and a Post # to the MongoDB URL. Say we wish to view tagging information of Post #4. Then, we will get the following run results:

Screen Shot 2022-05-16 at 9 43 21 PM


  1. Delete a post. case: 'DELETE'
    Now, let's delete the post we created. We currently have a total of 4 posts on our database. Deleting a post requires a password. Let's delete Post #4, which has the password "minjae123". Similar to editing posts, we will pass the password as a Header:

Screen Shot 2022-05-16 at 9 46 47 PM


Successfully deleted post! Now see our database: total number of posts has decreased from 4 to 3:

Screen Shot 2022-05-16 at 9 47 43 PM

About

REST API that allows users to create, edit, view or delete an online post on an Online Forum. Utilized AWS Lambda.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published