Skip to content

Commit 3dfe3a9

Browse files
committed
done
1 parent b7802dc commit 3dfe3a9

File tree

2 files changed

+21
-20
lines changed

2 files changed

+21
-20
lines changed

app.js

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,6 @@ app.use(
1818
})
1919
);
2020

21-
app.post("/insert", (req, res) => {
22-
client.insert(
23-
{
24-
email: req.body.email,
25-
firstName: req.body.firstName,
26-
lastName: req.body.lastName,
27-
},
28-
(err, response) => {
29-
if (!err) {
30-
console.log("Success");
31-
res.redirect("/");
32-
console.log(response);
33-
} else {
34-
console.log(err.details);
35-
}
36-
}
37-
);
38-
});
39-
4021
app.get("/", (req, res) => {
4122
// Getting getAll function from the client
4223
client.getAll({}, (err, response) => {
@@ -62,6 +43,26 @@ app.get("/:id", (req, res) => {
6243
});
6344
});
6445

46+
app.post("/insert", (req, res) => {
47+
// Getting Insert function from the client
48+
client.insert(
49+
{
50+
email: req.body.email,
51+
firstName: req.body.firstName,
52+
lastName: req.body.lastName,
53+
},
54+
(err, response) => {
55+
if (!err) {
56+
console.log("Success");
57+
res.redirect("/");
58+
console.log(response);
59+
} else {
60+
console.log(err.details);
61+
}
62+
}
63+
);
64+
});
65+
6566
const PORT = process.env.PORT || 3000;
6667

6768
app.listen(PORT, () => {

server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ function main() {
5959
insert: insert,
6060
});
6161

62-
server.bind("0.0.0.0:3001", grpc.ServerCredentials.createInsecure()); // Binds to a port -- createInsecure() is given to say there is no authentication in the server
62+
server.bind("0.0.0.0:3001", grpc.ServerCredentials.createInsecure()); // Binds to a port -- createInsecure() is used when there is no authentication in the server
6363
console.log("RUNNING ON 3001");
6464
server.start();
6565
}

0 commit comments

Comments
 (0)