Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
dfreeman500 committed Jun 8, 2022
1 parent b2338a3 commit 1e54ea2
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,38 @@
# javascript-api-public-reference
## The following is a README for a private repository of a backend assessment (code 'interview') I completed for Hatchways.io. The company asked that the code not be hosted publicly as they use this assessment for many different people. I have hosted it privately on github and could make it available if needed.

#

## Backend Assessment for Hatchways.io
Written in Javascript
See Back-end Assessment.pdf for assessment details.
#
## Summary of Tasks:

[x] Task 1: Create api/ping route which returns successful status code **(index.js)**
* Ex: of valid route:
* http:https://localhost:3000/api/ping

[x] Task 2: Create api/posts route which takes in mandatory tag(s) and can optionally take in sortBy and direction. Response must combine requests but return unique objects which are sorted correctly. Error codes must be sent back for absent tags or invalid sortBy/direction parameters. **(index.js)**
* Ex: of valid routes/requests:
* http:https://localhost:3000/api/posts?tags=tech
* http:https://localhost:3000/api/posts?tags=tech&sortBy=id
* http:https://localhost:3000/api/posts?tags=tech&direction=asc
* http:https://localhost:3000/api/posts?tags=tech&sortBy=popularitydirection=desc

[x] Task 3: Unit tests - utilizing Jest - **(index.test.js)**
[x] Task 4: Bonus- implement a server side cache
* **apicache** is used as the server side cache. Times in Postman go from 600-700 ms for return of data to 4-6 ms with use of the cache. A duplicate unit test is provided in **index.test.js** to compare times in ms.

#
## This project uses:
* Node.js: v18.2.0 -- https://nodejs.org/en/
* Express: 4.18.1 -- https://www.npmjs.com/package/express
* Jest: 28.1.0 -- https://www.npmjs.com/package/jest
* apicache: 1.6.3 -- https://www.npmjs.com/package/apicache

#
## Instructions:
* In the terminal/project directory type "npm install"
* Type "node index.js" to start server at http:https://localhost:3000/
* Interact with step one (http:https://localhost:3000/api/ping) and step two (ex: http:https://localhost:3000/api/posts?tags=tech,history,culture,science&sortBy=popularity&direction=desc)
* Utilize "npm test" to see unit test results

0 comments on commit 1e54ea2

Please sign in to comment.