REST API with Express.js
MongoDB / Express

This Example will show you how to make a REST API using Express.js MongoDB.

The database of the example is named to netdb and it contains a collection named book.

The book -collection has these fields:

  • name
  • author
  • isbn

You can create the database with example data like this:

  1. Connect to Mongo
  2. Execute command
    use netdb
    
  3. Execute command
    db.createCollection("book")
    
  4. Execute commands
    db.book.insert({name:'Algebra', author:'Jim Jones', isbn:'123-456'})
    db.book.insert({name:'JavaScript', author:'Lisa Smith', isbn:'111-222'})
    



Toggle Menu