This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const covidINdata = await axios.get('https://api.covid19api.com/live/country/india/status/confirmed'); | |
const latestData = covidINdata.data; | |
const recentData = latestData[latestData.length - 1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | |
const redis = require('redis'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
//Redis connection |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const mongoose = require('mongoose'); | |
const bodyParser = require('body-parser'); | |
const redis = require('redis'); | |
const app = express(); | |
app.use(bodyParser.json()); | |
mongoose.connect('mongodb://localhost:27017/', { | |
dbName: 'notes', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const bodyParser = require('body-parser'); | |
const jwt = require('jsonwebtoken'); | |
const bcrypt = require('bcrypt'); | |
app.use(bodyParser.json()); | |
app.use(bodyParser.urlencoded({ | |
extended: true | |
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const os = require('os'); | |
console.log(os.arch()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const fs = require('fs').promises; | |
fs.copyFile('new_sample.txt', 'copied_file.txt').then(() => { | |
console.log('File copied'); | |
}).catch((err) => { | |
console.log(err); | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const fs = require('fs'); | |
fs.rename('sample.txt', 'new_sample.txt', (err) => { | |
if (err) { | |
throw err; | |
} | |
console.log('File renamed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const fs = require('fs'); | |
fs.unlink('message.txt', (err) => { | |
if (err) { | |
throw err; | |
} | |
console.log('File has been removed'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const fs = require('fs'); | |
fs.open('sample.txt', 'r+', (err, fd) => { | |
if (err) { | |
throw err; | |
} | |
console.log('File is opened'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const fs = require('fs'); | |
const data = Buffer.from('This is message to be stored'); | |
fs.writeFile('message.txt', data, (err) => { | |
if (err) { | |
throw err; |