ChrisMichaelPerezSantiago / covid19

This API provides updated real-time data on coronavirus cases from the worldometers page, provided by the most reputable organizations and statistical offices in the world.
MIT License
76 stars 17 forks source link

Covid19 React Project Implementation. #9

Closed kedsnaik closed 4 years ago

kedsnaik commented 4 years ago

Hello Sir,

I had a query regarding the package implementation. How do I use it in my react project. Like how do I import the package and use it like any other npm package. I see that there are many functionalities that come with the package but there is no code example of as to how we actually implement it in the code. I tried running the functions from my terminal, but it didn't work. Can you please help me with it so that I can quickly proceed with the development. I am eagerly waiting your response.

Thank you.

ChrisMichaelPerezSantiago commented 4 years ago

Of course my friend @kedsnaik , That's what we are for, to help us.

You must first install the package using the terminal

npm i covid19-api

Then in a file with extension *.js or *.ts you must import the package as follows

const api = require('covid19-api');

index.js file And so on, successively with the other functions.

const api = require('covid19-api')

const main = async() =>{
  const capacityInfoUSHealthFacilities = await api.getCapacityInfoUSHealthFacilities();
  console.log(JSON.stringify(capacityInfoUSHealthFacilities , null , 2))
}

main();

Any other questions, questions, you can let me know. In order to help you!!