An implementation of a small subset of the capabilities of the Hacker News Algolia API. New Items are retrieved every hour from the main HN API.
Nest framework TypeScript starter repository.
Local
$ npm install
Docker container
# Bundled with a postgresql database
$ docker compose -f "docker-compose.yml" up --build
# docker
$ docker compose -f "docker-compose.yml" up
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
A Postman collection and enviroment are provided inside the postman forder for easy of use
All endpoints require a Bearer token to be used, to obtain a token:
- In postman set the api enviroment variable to the appropiate URL, by default it'll be localhost:3000 unless changed by the .env files
- Import the Collection and enviroment files from the postman folder into Postman
- Inside the collection run the login request, it will return a JWT auth token. The default body of the request must be:
// This user is seeded on to the DB by default
{
"email": "[email protected]",
"password": "password"
}
- Put the received token on the postman's jwt enviroment variable
- All the other endpoints are ready to be used
- The API Docs are available at /api/docs
- The .env files are included in the repository only to aid the ease of use, I undestand is a bad practice to do so.
- One thing I'd have liked to do would be to implement the complex tags filtering from the Algolia API, I did not have enough time this weekend.
- An Online version of this API is available at my personal site https://api.servinges.cl because I wanted to demostrate that I have some knowledge about web servers configuration (nginx), ec2, web hosting, certificates, etc.
Nest is MIT licensed.