flask | 代写express | javascript | java | Python – Backend Assessment – Blog Posts

Backend Assessment – Blog Posts

flask | 代写express | javascript | java | Python – 该题目是一个常规的javascript的练习题目代写, 是比较有代表性的flask/express/javascript/java/Python等代写方向

python代写 代写python

In this assessment, you will write a simple backend JSON API. If you notice something is not working (like the API, or any of the links in this document), please contact [email protected].

This assessment will be evaluated based on the following criteria: Completion: Did you complete all the steps? Does each part work properly? This is the most important criterion. Please note that we mark for completion automatically, therefore its your job to ensure all the routes, parameters and responses are named and formatted correctly. Fundamentals: Is your code efficient? Do you use the appropriate data structures? Code Organization and Quality: How organized is your solution? Testing: Did you write some tests for the solution? How is the coverage? Speed: We are looking for solutions that are completed within an appropriate time frame (around 6 hours is an appropriate time frame). Communication: We are looking for candidates with strong communication skills. This will be evaluated based on your Readme.md file.

Resources

If you are not familiar with how to set up a basic API, we recommend the following resources: Python flask (Flask JSON API) javascript – Node + express java – Spring Boot (JSON API) Ruby – Rails JSON API

You may use any type of backend API framework. Please document in a Readme how to start the application.

Data Source

You will be building an API that requires you to fetch data from this API:

Request:
Route:  https://hatchways.io/api/assessment/blog/posts
Method:  GET
Query Parameters:
Field Type Description
tag String (required) The tag associated with
the blog post.

Notice that the parameter is a query parameter – you can read more about query parameters here. An example of sending the tag parameter is https://hatchways.io/api/assessment/blog/posts?tag=tech.

Our API can only filter one tag at a time – notice that the field tag is singular and not plural.

It will return a JSON object with an array of blog posts. An example response is:

{
"posts" : [{
"id" : 1,
"author" : "Rylee Paul",
"authorId" : 9,
"likes" : 960,
"popularity" : 0.13,
"reads" : 50361,
"tags" : [ "tech", "health" ]
},
...
]
}

API Requirements

You need the following routes in our API:

Route 1:
Request:
Route:  /api/ping
Method:  GET
Response:
Body:
{
"success": true
}
Status: 200
Route 2:
Request:
Route:  /api/posts
Method:  GET
Query Parameters:
Field Type Description Default Example
tags String
(required)
A comma separated
list of tags.
N/A science,tech
sortBy String
(optional)
The field to sort the
posts by. The
acceptable fields are:
 id
 reads
 likes
 popularity
id popularity
direction String
(optional)
The direction for
sorting. The acceptable
fields are:
 desc
 asc
asc asc

Successful Response:

The response of the API will be a list of all the blog posts that have at least one tag specified in the tags parameter. The sortBy parameter specifies which parameter should be used to sort the results return. It is an optional parameter, with a default value of id. The direction parameter specifies if the results should be returned in ascending order (if the value is “asc”) or descending order (if the value is “desc”). The default value of the direction parameter is asc.

Here is how the response would look like: Body: { “posts”: [{ “id”: 1, “author”: “Rylee Paul”, “authorId”: 9, “likes”: 960, “popularity”: 0.13, “reads”: 50361, “tags”: [ “tech”, “health” ] }, … ] } Status: 200

Error Responses: If tags parameter is not present: Body: { “error”: “Tags parameter is required” } Status: 400

If a sortBy or direction are invalid values, specify an error like below: Body: { “error”: “sortBy parameter is invalid” } Status: 400

In order to complete this task you will need to: For every tag specified in the tags parameter, fetch the posts with that tag using the Hatchways API ( make a separate API request for every tag specified) Combine all the results from the API requests above and remove all the repeated posts (try to be efficient when doing this) You will get a better score on our assessment if you can make concurrent requests to the API (making the requests in parallel) (we understand that this job is easier in some languages vs. others)

We have provided an API with the correct solution. This should only be used to verify your results. Do not call this API in your application. Here it is in action: https://hatchways.io/api/assessment/solution/posts?tags=history,tech&sortBy=likes& direction=desc

Step 3

An important part of development is testing. In this step, we want to see tests written for your routes. Do not use the solutions API route to perform testing in this step. Think about the different ways to test the app, and the best way to get good coverage.

Step 4 (Bonus!)

Making API calls to other servers can be expensive. How can you reduce the number of calls you make to a server? You can cache the results of an API call on your server. Try to implement a server side cache to our API. Two tips are 1) keep it simple, and 2) feel free to use existing libraries/frameworks.

Readme

Along with your submission, write a Readme.md file that: Describes how to run the application. This includes: The command we should use installing your dependencies, e.g: npm install, pip install -r requirements.txt. You can assume we already have your programming language set up in our environment, as well as any common package managers (npm, yarn, bundle, pip, etc) The command we should use for actually running the application, e.g: npm start, java Main, python manage.py serve A brief (three sentences) high-level description of your project, aimed at a non-technical person. This will help us assess how well you can communicate

Checklist

Before submitting your assessment, make sure you have: An /api/posts route that handles the following query parameters: tags (mandatory) : any number of comma-separated strings sortBy (optional) : one of id, reads, likes, popularity direction (optional) : one of asc, desc, defaults to asc Error handling: Return an error message if: tags parameter is missing sortBy or direction has an invalid value Testing without using our solution API route A Readme.md file as described above Caching (bonus)

Submission Details

Please submit your code in a compressed folder (.zip, .sitx, .7z, .rar, and .gz) on the Hatchways platform. The max submission size is 5MB.

Do not submit any built folders, since the compressed folder will be too large.

If your submission is too big (although this should not be the case if you follow the steps above), and you can’t figure out how to compress, you are welcome to email your solution to [email protected].

Please include your name, and use the email you signed up with the Hatchways platform. Use the subject line Backend Assessment Submission.

Public Repositories

Please avoid posting your solution to a public repository. We understand that you may want to share projects you have worked on, but many hours go into developing our tools so we can provide a fair skills evaluation.

If you would like to keep a similar version of the assessment on a public repository to showcase your skills, then please do the following: Remove all references to Hatchways in the assessment Do not use any Hatchways APIs (replace them with an API of your own)