Real time covid-19 tracker api using node js & express js. below plugin are used to implement API:
cors, csv-parser, express, mongodb, node-cron, request
CORS used for allow Access-Control-Allow-Origin for that need to use middleware : app.use(cors()).
csv-parser
can convert CSV into JSON at at rate of around 90,000 rows per second.Example :
fs.createReadStream('filepath') .pipe(csv()) .on('data', (data) => results.push(data)) .on('end', () => { console.log(results); });
The node-cron module is tiny task scheduler in pure JavaScript for node.js based on GNU crontab. This module allows you to schedule task in node.js using full crontab syntax. Syntax :
cron.schedule('* * * * *', () => { console.log('running a task every minute');});
Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. Syntax:
request('http://www.google.com', function (error, response, body) { console.error('error:', error); // Print the error if one occurred console.log('statusCode:', response && response.statusCode); // Print the response status code if a response was received console.log('body:', body); // Print the HTML for the Google homepage.});
procedure to run COVID-19 API :
- clone from git link : git clone https://github.com/tapanspectrum/covid19.git
- cd covid19
- npm install
- npm start
July 28, 2022 at 4:14 pm
I was pretty pleased to discover this great site. I want to to thank you for ones time due to this fantastic read!! I definitely appreciated every part of it and I have you book marked to look at new stuff on your web site.
August 26, 2022 at 10:22 pm
Can I simply say what a comfort to uncover a person that truly understands what they are talking about online. You definitely realize how to bring an issue to light and make it important. A lot more people ought to check this out and understand this side of your story. Its surprising youre not more popular because you definitely have the gift.