Saving Data with a Form

It’s great that our application is able to list bundles that already exist, but what about adding new ones? The right tool for this job is the venerable HTML <form> tag. Using a form, we can capture user input and process it by making a proxied call to the back-end APIs. Since the form is static HTML, we’ll put it in app/templates.ts. Open that file now and add this template.

 export​ ​const​ addBundleForm = Handlebars.compile(​`
  <div class="panel panel-default">
  <div class="panel-heading">Create a new bundle.</div>
  <div class="panel-body">
  <form>
  <div class="input-group">
  <input class="form-control" placeholder="Bundle Name" />
  <span class="input-group-btn">
 

Get Node.js 8 the Right Way now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.