Book Image

Learning Single-page Web Application Development

Book Image

Learning Single-page Web Application Development

Overview of this book

Table of Contents (15 chapters)
Learning Single-page Web Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Inserting data with Postman


To solve our empty database and before we create our frontend interface, let's add some data with the Chrome extension Postman. By the way, it's a very useful browser interface to work with RESTful APIs.

As we already know that our database is empty, our first task is to insert a record. To do so, perform the following steps:

  1. Open Postman and enter http://localhost:8080/api/speakers. Select the x-www-form-urlencoded option and add the properties of our model:

    var SpeakerSchema   = new Schema({
      name:           { type: String, default: '' },
      company:        { type: String, default: '' },
      title:          { type: String, default: '' },
      description:    { type: String, default: '' },
      picture:        { type: String, default: '' },
      schedule:       { type: String, default: '' },
      createdOn:      { type: Date,   default: Date.now}
    });
    
  2. Now, click on the blue button at the end to send the request.

  3. With everything going as expected, you should see message: speaker...