Commit 73b939bb authored by RusiraPathum's avatar RusiraPathum

final2

parent 14f385dd
......@@ -24,25 +24,22 @@ docker-compose up -d aplos
docker-compose up -d gateway
docker-compose up -d web
```
** After hosting website, it can be reached on `<Ip address of the Vm>:4300`.
** After hosting website, it can be reached on `<Ip address of the Vm>:4600`.
#### 1. add student details
```
# request
axios
.post("http://localhost:8070/student/add", newStudent)
.then(() => {
alert("Student Added");
document.getElementById('name').value = "Pathum";
document.getElementById('age').value = "23";
document.getElementById('gender').value = "Male";
})
.catch((err) => {
alert(err);
});
curl -XPOST "http://localhost:7654/api/students" \
--header "Content-Type: application/json" \
--header "Bearer: eyJkaWdzaWciOiJORWpYZnIwQjJMZG4ySGxPb2t5blp0dkNzSFVqMGFoVTVZd1F5TmJSVCtOYjlwTnBXcEsvUi9UbDZpanhPVVJiVlJHc2NHaFIrcWVCbkZhK09YYjBmMGlacVh0WHBDVXV6bnJOcTFKRmpGZC8zSU80L1o4SXl3WG1EdWFGcUg5Njc5VE9neVRkcU1nT01VeWNNWTF0bmtIUStWVUtUN0JTV0NWMEM3ZmNXbEE9IiwiaWQiOiJlcmFuZ2FlYkBnbWFpbC5jb20iLCJpc3N1ZVRpbWUiOjE1NTg0ODk4ODksInJvbGVzIjoiIiwidHRsIjo2MH0=" \
--data '
{
"studentId": "54",
"name": "Pathum",
"age": "23",
"gender": "Male"
}
'
# reply
......@@ -54,15 +51,13 @@ axios
```
# request
axois
.get("http://localhost:8070/student/")
.then((res) => {
setStudents(res.data);
// console.log(res);
})
.catch((err) => {
alert(err.message);
});
curl -XPOST "http://localhost:7654/api/students" \
--header "Content-Type: application/json" \
--header "Bearer: eyJkaWdzaWciOiJORWpYZnIwQjJMZG4ySGxPb2t5blp0dkNzSFVqMGFoVTVZd1F5TmJSVCtOYjlwTnBXcEsvUi9UbDZpanhPVVJiVlJHc2NHaFIrcWVCbkZhK09YYjBmMGlacVh0WHBDVXV6bnJOcTFKRmpGZC8zSU80L1o4SXl3WG1EdWFGcUg5Njc5VE9neVRkcU1nT01VeWNNWTF0bmtIUStWVUtUN0JTV0NWMEM3ZmNXbEE9IiwiaWQiOiJlcmFuZ2FlYkBnbWFpbC5jb20iLCJpc3N1ZVRpbWUiOjE1NTg0ODk4ODksInJvbGVzIjoiIiwidHRsIjo2MH0=" \
--data '
{
"studentId": "54"
}
'
# reply
......@@ -73,25 +68,16 @@ axois
```
# request
axios
.get(`http://localhost:8070/student/get/` + sid)
.then((res) => {
setStudents(res.data);
studentId1 = res.data._id;
name1 = res.data.name;
age1 = res.data.age;
gender1 = res.data.gender;
// console.log(age1);
document.getElementById("studentId").valu studentId1;
document.getElementById("name").value = name1;
document.getElementById("age").value = age1;
ocument.getElementById("gender").value = gender1;
})
.catch((err) => {
alert(err.message);
});
curl -XPOST "http://localhost:7654/api/students" \
--header "Content-Type: application/json" \
--header "Bearer: eyJkaWdzaWciOiJORWpYZnIwQjJMZG4ySGxPb2t5blp0dkNzSFVqMGFoVTVZd1F5TmJSVCtOYjlwTnBXcEsvUi9UbDZpanhPVVJiVlJHc2NHaFIrcWVCbkZhK09YYjBmMGlacVh0WHBDVXV6bnJOcTFKRmpGZC8zSU80L1o4SXl3WG1EdWFGcUg5Njc5VE9neVRkcU1nT01VeWNNWTF0bmtIUStWVUtUN0JTV0NWMEM3ZmNXbEE9IiwiaWQiOiJlcmFuZ2FlYkBnbWFpbC5jb20iLCJpc3N1ZVRpbWUiOjE1NTg0ODk4ODksInJvbGVzIjoiIiwidHRsIjo2MH0=" \
--data '
{
"studentId": "54",
"name": "Sandeepa",
"age": "24",
"gender": "Male"
}
'
# reply
......@@ -103,20 +89,15 @@ axios
```
# request
axois
.delete(`http://localhost:8070/student${id}`)
.then(() => {
alert("Successfully Deleted");
window.location.reload();
})
.catch((err) => {
alert(err.message);
});
onClose();
curl -XPOST "http://localhost:7654/api/students" \
--header "Content-Type: application/json" \
--header "Bearer: eyJkaWdzaWciOiJORWpYZnIwQjJMZG4ySGxPb2t5blp0dkNzSFVqMGFoVTVZd1F5TmJSVCtOYjlwTnBXcEsvUi9UbDZpanhPVVJiVlJHc2NHaFIrcWVCbkZhK09YYjBmMGlacVh0WHBDVXV6bnJOcTFKRmpGZC8zSU80L1o4SXl3WG1EdWFGcUg5Njc5VE9neVRkcU1nT01VeWNNWTF0bmtIUStWVUtUN0JTV0NWMEM3ZmNXbEE9IiwiaWQiOiJlcmFuZ2FlYkBnbWFpbC5jb20iLCJpc3N1ZVRpbWUiOjE1NTg0ODk4ODksInJvbGVzIjoiIiwidHRsIjo2MH0=" \
--data '
{
"studentId": "54",
}
'
# reply
{"name":"Sandeepa","age":"24","gender": "male"}
{"code":200,"msg":"Successfully Deleted Student Details"}
```
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment