aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--routes/api/members.js3
-rw-r--r--views/index.handlebars12
2 files changed, 14 insertions, 1 deletions
diff --git a/routes/api/members.js b/routes/api/members.js
index f1498ae..36b66aa 100644
--- a/routes/api/members.js
+++ b/routes/api/members.js
@@ -33,7 +33,8 @@ router.post('/', (req, res) => {
}
members.push(newMember);
- res.json(members);
+ //res.json(members);
+ res.redirect('/nodejs');
});
// Updat Member
diff --git a/views/index.handlebars b/views/index.handlebars
index 1b430da..d31363a 100644
--- a/views/index.handlebars
+++ b/views/index.handlebars
@@ -1,4 +1,16 @@
<h1 class="text-center mb-3">{{title}}</h1>
+
+<form action="/nodejs/api/members" method="POST" class="mb-4">
+ <div class="form-group">
+ <label for="name">Name</label>
+ <input type="text" name="name" class="form-control">
+ </div>
+ <div class="form-group">
+ <label for="email">E-mail</label>
+ <input type="email" name="email" class="form-control">
+ </div>
+ <input type="submit" value="Add Member" class="btn btn-primary btn-block">
+</form>
<h4>Members</h4>
<ul class="list-group">
{{#each members}}