Giter VIP home page Giter VIP logo

express-sequelize-creatures's Introduction

Prehistoric Creatures Lab


For this lab, you're going to add a prehistoric creatures section to the dinos app.

1. Add a prehistoric_creatures.json file to your dinos directory. Give it the following data:

[
  {
    "type":"giant beaver",
    "img_url":"http://www.beringia.com/sites/default/files/Giant-Beaver-banner.jpg"
  },
  {
    "type":"mastodon",
    "img_url":"https://cdn-images-1.medium.com/max/1200/1*a2VvYsKGApR-E1SnT5O7yQ.jpeg"
  },
  {
    "type":"saber-toothed salmon",
    "img_url":"https://cottagelife.com/wp-content/uploads/2014/11/Oncorhynchus_rastrosus.jpg"
  },
  {
    "type":"megalonyx",
    "img_url":"https://animalgeography.files.wordpress.com/2018/08/sloth-banner-e1535192925361.jpg?w=584&h=325"
  }
]

2. Update the dbTest.js file to create creatures based off prehistoric_creatures.json

Hint 1: You can require() any file, including .json files

Hint 2 : bulkCreate() works great with an array of data

Make sure that when you're finished, you can see the new prehistoric creatures inside of your psql database!

3. Create the following routes:

VERB URL Action (CRUD) Description
GET /creatures Index (Read) displays all prehistoric creatures
GET /creatures/1 Show (Read) displays the type and photo of a particular prehistoric creature (id = 1)
POST /creatures Create creates an prehistoric creature with the POST payload data

Bonus!

4. Add the remaining two CRUD routes, Update and Delete

5. Reorganize your routes into controllers

(one controller for dinosaurs and one controller for prehistoric creatures)

Hint!: Look up express.Router and put your creaturesController.js in a controllers folder

express-sequelize-creatures's People

Contributors

h64 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.