wikipedia wrapper
STEPS TO SETUP
- Install NODE 17 + and NPM 8 +
- Install redis v7 +
- start redis server with
redis-server
- note the port, default is
6379
- Setup .env file with vars,
HOST
andPORT
, this will be used for Redis your HOST is your localhost like so
HOST='127.0.0.1'
PORT='6379'
SERVER_PORT='3000'
- Add var for
SERVER_PORT
, I used3000
for my default - Run
npm i
in root directory,/wikitest/
- Run
npm start
to start server, you should see fastify intiate logging, base urlshould behttp://localhost:3000/
ENDPOINTS
For month
URL: /v1/month/:YYYY-MM
For week
URL: /v1/month/:YYYY-MM-DD
Both endpoints should return the following JSON
[
{"articleName": string, "views": int, "most": int, "date": string },
...
]
articleName
will be a string value that is the name of the article
view
is an int value that is the total view for the week/month
most
is an int value that is the highest day of views for a given week/month
date
is a date formatted string that indicates the day for a given article that had the highest views
TEST
testing uses tap
and is built into npm
simply run npm test
in the root dir