Giter Site home page Giter Site logo

webdb-ii-challenge's Introduction

Web DB II Module Challenge

In this challenge, you will write an API that can be used to manage Zoos stored in a Relational Database.

Project Set Up

Follow these steps for starting your project.

  • Fork this repository and clone your fork.
  • Add your project manager as collaborator on your fork.
  • Create a new branch: git checkout -b <firstName-lastName>.
  • Implement the project on your newly created <firstName-lastName> branch, committing changes regularly.
  • Push commits: git push origin <firstName-lastName>.

Follow these steps for completing your project.

  • Submit a Pull-Request to merge <firstName-lastName> Branch into master (student's Repository). Please don't merge your own pull request
  • Add your project manager as a reviewer on the pull-request
  • Your project manager will count the project as complete by merging the branch back into master.

Minimum Viable Product

  • Configure knex to connect to the /data/lambda.db3 database using the sqlite3 npm module.
  • Write a set of endpoints inside index.js to satisfy the specifications listed below. Feel free to extract the endpoints to it's own express Router.
  • To start the API, type npm run server.
  • Use a rest client like Insomnia or Postman to test your API.

Specifications

The included database has a zoos table with the following schema:

Column Data Type Details
id integer primary key, auto-increments
name text required, unique

POST /api/zoos

When the client makes a POST request to this endpoint, a new zoo should be created in the zoos table.

Ensure the client passes a name property in the request body. If there's an error, respond with an appropriate status code, and send a JSON response of the form { error: "Some useful error message" }.

Return the inserted zoo and a 201 status code.

GET /api/zoos

When the client makes a GET request to this endpoint, return a list of all the zoos in the database. Remember to handle any errors and return the correct status code.

GET /api/zoos/:id

When the client makes a GET request to /api/zoos/:id, find and return the zoo associated with the given id or an HTTP status code 404 and a helpful message if no zoo with that id exists. Remember to handle errors and send the correct status code.

DELETE /api/zoos/:id

When the client makes a DELETE request to this endpoint, the zoo that has the provided id should be removed from the database.

PUT /api/zoos/:id

When the client makes a PUT request to this endpoint passing an object with the changes, the zoo with the provided id should be updated with the new information.

Stretch Problem

Add a new bears table to the database and add endpoints to perform CRUD operations on it. Each bear should have an id and name property similar to the zoos table.

webdb-ii-challenge's People

Contributors

luishrd avatar jeremybrady702 avatar ericathompson avatar mixelpixel avatar samjeffcoat avatar

Watchers

James Cloos 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.