INTRODUCTION

idnlt arose from the necessity to have an API whereby one can easily fetch the symptoms of different Sexually Transmitted Infections. The API is open and free to use and currently contains a total of 11 common STI’s along with their associated symptoms in men and women.

PARAMETERS

There are a few other key value pairs apart from symptoms that can be fetched from the idnlt API.

  •  id
  •  infectionName
  •  symptomsWomen
  •  symptomsMen
  •  nickName
  •  isThereVaccine

CODE SAMPLE

***import the dependencies***

import fetch from "node-fetch"
import express from "express"

const app = express()

const url = "https://idnlt.herokuapp.com/api/v2"

***the aysnc function to fetch the data from the api***

const fetchData = async () => {
  try{
    let response = await fetch(url)
    let data = await response.json()
    console.log(data)
  } catch(error){
    console.log(error.message)
  }
}

***the get route***

app.get('/', (req, res) => {
  fetchData();
})

// Set up the local server

const PORT = process.env.PORT || 3000

app.listen(PORT, () => {
  // it just means "Server is online/live"
  console.log("Server ti wa online")
})

TECHNOLOGIES

  •  HTML5
  •  CSS3
  •  JAVASCRIPT
  •  NODEJS
  •  EXPRESS.JS
  •  mongoose
  •  MongoDB
  •  DOCKER(for versions 1 and 2)
  •  HEROKU
Tags: , , , , , ,
Lare is a FrontEnd Engineer & Product Designer. This is a journal of his journey in Computer Science. It would contain different projects built with various technologies. You can reach him via email contact@laresamdeola.com or through his github @laresamdeola.

0 Comments

Leave a Comment