api-exam's People
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.... successGET /multiday
returns all multiday backpacks....successGET /backpacks/daypack_CamelBak_Rim_Runner_22_Hydration_Pack
...successPOST /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!"
},
...
Instructions for loading data
Add instructions on how to load data and couchdb views within your readme.md file.
Add both views within addViews.js
Running addViews.js only adds the last view. I had to modify code to add the first view.
Use JSON in error messaging
- Consider using JSON in the response data instead of text.
API Design
- While
GET \multiday
andGET \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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.