Project Part 1
This is your first real project for the course. In it, you will develop the API that you use in developing the rest of the projects. You will be using a JavaScript framework to build a web backend for an image-sharing website. In particular, you’re designing and implementing a REST endpoint to maintain your website’s state.
Requirements
There are two principle pieces of this assignment. The first is a specification of your API. The second is the implementation of the API itself that I will test. Both of these are important steps in the process, and will be graded.
The core role of your API is to provide access to the data in a Couchbase backend. I will submit a merge request to your project to add Couchbase as a dependency to the project and add the mock database. The mock database will allow us to test your code without installing a Couchbase server. I expect the data to be stored in Couchbase using the following data model:
Bucket “x440_user_data” – default collection
ID: user_id
Document:
“username”: string,
“original_posts”: [string]. // each string is a post id
“commented_on_posts”: [string] // each string is a post id
Bucket “x440_post_data” – default collection
ID: post_id
Document:
“title”: string,
“author_id”: string,
“create_time”: string, //RFC 3339 Timestamp, UTC
“caption”: string,
“mimetype”: string, // mimetype for corresponding image file
“comments”: [
“comment”: string,
“author_id”: string,
“create_time”: string //RFC 3339 Timestamp, UTC
]
Bucket “x440_images” – default collection
ID: post_id
Document:
Raw bytes of image.
Your API design must provide Create and Read access to this data. It must also follow REST principles, and be implemented as JSON (or image) over HTTP, using the correct HTTP verbs and response codes. In your design document, you may assume all requests will be well formed JSON over HTTP. This design document should be in a Markdown file in the root of the repository.
The second part of the project is implementing your API. I will give you a “hello world” example of a single endpoint for the server we use in class. Your implementation is dependent upon your definition in the previous part. It is important that you faithfully implement your described API, since my testing will be based solely on how you describe your interface.
Restrictions
Please do not use any outside JavaScript libraries, except the ones I install in your npm project. Also, please conform to the academic integrity policy of the course.
Submitting
To submit the project, create a new release in GitLab with name like “project1-24-08-2020” (instructions available at https://docs.gitlab.com/ee/user/project/releases/index.html#create-a-release) and email me that you would like it graded. You may do this up to two times a week. I will do my best to get back to you with a graded rubric by the end of the next workday. This project, like all other projects, is due Friday, December 4, 2020 at noon. However, I recommend that you finish this within the first few weeks of its availability. You may find it useful to submit after the design document is finished to get early feedback on your API design before you believe you have finished the implementation.
Rubric
Points | Requirement | Comment |
API Definition Requirements | ||
__/3 | Language and formatting of definition is clear | |
__/1 | Definition is Stateless | |
__/1 | Definition is Cacheable | |
__/1 | Definition includes resource identification in requests | |
__/1 | API is navigable (HATEOAS) | |
__/1 | Correct use of HTTP verbs | |
__/1 | Separation of collection and member resources | |
__/3 | Endpoints for post make all data visible and creatable | |
__/3 | Endpoints for user make all data visible and creatable | |
Implementation Requirements | ||
__/3 | Endpoints for user make all data visible and creatable | |
__/3 | Endpoints for post make all data visible and creatable | |
__/1 | API handles malformed JSON requests properly | |
__/1 | API handles requests to missing resources properly | |
__/1 | API handles requests to unknown endpoints | |
__/2 | API can serve multiple clients concurrently | |
Documentation Requirements | ||
__/1 | Project runs with `git pull`, `npm install`, `npm start`, and visiting `https://localhost:8888` in the browser | |
__/1 | README.md explains what source files do and source files contain meaningful comments | |
__/28 | __/28 * 7 = ____ |