Unit 4:node JS& Mongodb Name: V Anirruth SRN: PES2UG20CS478 Section: H Date: 23/11/2021 Unit 4 Assignment Exercise
Unit 4:node JS& Mongodb Name: V Anirruth SRN: PES2UG20CS478 Section: H Date: 23/11/2021 Unit 4 Assignment Exercise
DEC
Unit 4:NODE JS& MONGODB 2021
The objective of this exercise is to test the student on NodeJS and MongoDB.It
evaluates the student’s knowledge ofhttp server creation using Node, Reading
from MongoDB and NodeJS MongoDB driver.
PREREQUISITE
DATABASE CREATION
PROGRAM
})
}
}).listen(8081);
console.log("Server started");
Second url
JSON.stringify(result[i].emp_id) + '</h1>');
}
response.end();
db.close();
})
})
}
}).listen(8081);
console.log("Server started");
2)
Main.js
const fs = require("fs");
const result = require("./module.js");
console.log(result.re);
console.log(result.re);
console.log(result.re);
console.log(result.re);
module.js
const result = Math.random() * (20 - 17) + 12
exports.re = result;
AUG-
DEC
Unit 4:NODE JS& MONGODB 2021
2)
AUG-
DEC
Unit 4:NODE JS& MONGODB 2021