GO / Mongo Atlas API ☁️

mongobadge mongobadge
MongoDB Go HTML5 CSS3 JavaScript

Basic API written in GO to a Cloud Mongodb, simply stores JSON information for you to call, also has very basic frontend written in for the post requests. Very simple and decided to open source as i didnt see one that was ready to deploy. Just create Mongodb using the link below and select GO drivers when getting URI for DB.

  • Good for small personal projects and quick deployment.
  • Anything you feel i missed or could be improved/structured please dm me

Example requests

GET

import requests

url = "http://YOUR_APIURL"


headers = {"Content-Type": "application/json"}

response = requests.request("GET", url, headers=headers)

print(response.text)

POST

url = "http://YOUR_APIURL"

payload = {
    "isbn": "Some",
    "title": "Title",
    "info": {
        "info1": "And",
        "info2": "Information",
        "info3": "N/A",
        "info4": "N/A"
    }
}
headers = {"Content-Type": "application/json"}

response = requests.request("POST", url, json=payload, headers=headers)

print(response.text)

PUT

url = "http://YOUR_APIURL/{_id}"

payload = {
    "isbn": "Some",
    "title": "Corrected",
    "info": {
        "info1": "Information",
        "info2": "N/A",
        "info3": "N/A",
        "info4": "N/A"
    }
}
headers = {"Content-Type": "application/json"}

response = requests.request("PUT", url, json=payload, headers=headers)

print(response.text)

DELETE

url = "http://YOUR_APIURL/{_id}"

headers = {"Content-Type": "application/json"}

response = requests.request("DELETE", url, headers=headers)

print(response.text)

GET (Specific ID)

url = "http://YOUR_APIURL/{_id}"

headers = {"Content-Type": "application/json"}

response = requests.request("GET", url, headers=headers)

print(response.text)

To do:

  • Build frontend for PUT/DELETE/GET
  • Maybe build on POSTGRES
  • Build queue system to carry out functions

Useful links

Discord
@lame impala#0304

toms stats

GitHub

View Github