Giter Site home page Giter Site logo

api-exam's People

Contributors

kendsdavs avatar

Watchers

 avatar  avatar

api-exam's Issues

Review

Positives

  • Starting node api and hitting http://localhost:3000/backpacks without loading the data resulted in a 404 error response and helpful error message. "Cannot GET /backpacks". Consider using JSON in the response instead of text.
  • Able to add data to new db via importbackpacksdata.js. Consider adding instructions to the readme.md file.
  • Able to add couchdb views to db. Consider adding instructions to the readme.md file.

Endpoints

  • GET /daypack returns all daypack daypack.... success
  • GET /multiday returns all multiday backpacks....success
  • GET /backpacks/daypack_CamelBak_Rim_Runner_22_Hydration_Pack...success
  • POST /backpacks ... success.

Enhance Readme.md file

  • Use markdown syntax within your README.md file to improve the usability of your API docs.

Remove couchdb noise from response data

  • Typical backpack data comes back like this:
{
"total_rows": 6,
"offset": 0,
"rows": [
{
"id": "daypack_CamelBak_Rim_Runner_22_Hydration_Pack",
"key": "CamelBak Rim Runner 22 Hydration Packdaypack_CamelBak_Rim_Runner_22_Hydration_Pack",
"value": null,
"doc": {
"_id": "daypack_CamelBak_Rim_Runner_22_Hydration_Pack",
"_rev": "1-ae1e44fd4f7346061228081fb65cd84a",
"name": "CamelBak Rim Runner 22 Hydration Pack",
"description": "The comfortable CamelBak Rim Runner 22 Hydration Pack is a capable gear hauler with a big reservoir to keep you hydrated during done-in-a-day adventures.",
"in_stock": true,
"cost": "$100",
"type": "daypack",
"date_available": "Available Today!"
}
},
{
"id": "daypack_Kelty_Redwing_44_Pack", 
...

You will need to map over the response from the db, and return just the contents of the doc.

{
"_id": "daypack_CamelBak_Rim_Runner_22_Hydration_Pack",
"_rev": "1-ae1e44fd4f7346061228081fb65cd84a",
"name": "CamelBak Rim Runner 22 Hydration Pack",
"description": "The comfortable CamelBak Rim Runner 22 Hydration Pack is a capable gear hauler with a big reservoir to keep you hydrated during done-in-a-day adventures.",
"in_stock": true,
"cost": "$100",
"type": "daypack",
"date_available": "Available Today!"
}, 
...

API Design

  • While GET \multiday and GET \daypack work, I think the following would be a more intuitive design:
    • \backbacks - GETs all backpacks
    • \backbacks\multiday and \backbacks\daypack gets a listing of specific types of backpacks. Alternatively, using a query string to categories which backpacks would also work . Ex: \backbacks?type=multiday

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.