A RESTful API built using NodeJS, Express, Axios, request. (index.js) Tested with Jest and Supertest. (index.test.js)
From github.
git clone https://github.com/godrowr/blogposts.git
cd blogposts
npm install
Inside your favourite terminal, do:
node src
Then proceed to http://locahost:3000
npm run test
Exit through crtl-c.
Two routes exist for blogposts:
Note: /api/posts must contain the query tag. ('?tag=tech')
http://locahost:3000/api/posts?tag=tech
- tag = { science, culture, tech, health, startups, history ...}
Used for multiple tag options. http://locahost:3000/api/posts?tags=tech,health
http://locahost:3000/api/posts?tags=tech,health&sortBy=likes
- sortBy = {likes, id, reads, popularity}
http://locahost:3000/api/posts?tag=tech&direction=asc
- direction = {asc, desc} Where 'asc' is ascending order and 'desc' is descending order.