Nodejs Application With Mongodb
Nodejs Application With Mongodb
EX.NO: 09
NODEJS APPLICATION WITH MONGODB
DATE:
AIM:
To design a back-end web application using NodeJS with MongoDB for Indian Dog
registrations.
PROCEDURE:
CODE
FSD Ex 8.html
<html>
<head>
<title>Indian Dog Breeds Registration</title>
<style>
body {
font-family: 'Arial', sans-serif;
background-color: #f4f4f4;
margin: 0;
padding: 0;
display: flex;
AKASH S (71812211005)
justify-content: center;
align-items: center;
height: 100vh;
}
.form-container {
background-color: white;
padding: 20px;
border-radius: 10px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
width: 300px;
text-align: center;
}
h1 {
color: #8B4513;
font-size: 24px;
margin-bottom: 20px;
}
label {
display: block;
margin-bottom: 5px;
font-weight: bold;
color: #555;
}
input,
select {
width: 100%;
padding: 10px;
margin-bottom: 15px;
border: 1px solid #ccc;
border-radius: 5px;
font-size: 14px;
}
button {
background-color: #8B4513;
color: white;
border: none;
AKASH S (71812211005)
.reset-button:hover {
background-color: #bbb;
}
</style>
</head>
<body>
Ex9_server.js
try {
const db = client.db("Indian-Dog-Registration");
const collection = db.collection("Owners");
const result = await collection.insertOne({
dogName,
breed,
age: Number(age),
AKASH S (71812211005)
ownerName,
contact
});
OUTPUT
AKASH S (71812211005)
AKASH S (71812211005)
INFERENCE
The form once submitted will send a POST request to the backend server. The sent data will be
received in the backend server and will process it and save in in the database. This can be confirmed in
MongoDB Compass.
RESULT:
Thus, back-end web application using NodeJS with MongoDB for Indian Dog registrations has
been verified and executed successfully.