This API provides a set of endpoints for jokes and math calculations.
This endpoint provides jokes from different sources.
- saved in postgres database
- from https://icanhazdadjoke.com/
- from https://api.chucknorris.io
GET /jokes
#### Create a joke and save it to DB
```bash
POST /jokesGET /jokes/{number}Returns a random joke from one of the following sources:
GET /jokes/randomReturns a joke from one of the following sources, based on the parameter type:
If the parameter type is "dad" will return a joke from this source:
- https://icanhazdadjoke.com/
If the parameter type is "chuck" will return a joke from this source: - https://api.chucknorris.io
If the parameter type is not "chuck" or "dad" will return an error
GET /jokes/by-type/{type}PUT /jokes/{number}DELETE /jokes/{number}This endpoint provides two mathematical endpoint to calculate the least common multiple of a list of numbers and an increment endpoint that will return the incremented number passed by query parameters .
GET /math/least-common-multiple?numbers=12&numbers=2&numbers=34&numbers=45GET /math/increment?number=12To build and run this app locally you will need a few things:
- Install Node.js
- Install Docker
- Install Docker-compose
This api use postgresql from Docker and is ready for use without any additional configuration.
- Clone the repository
git clone --depth=1 https://github.com/Microsoft/TypeScript-Node-Starter.git <project_name>- Install dependencies
cd <project-name>
npm install- Build and run the project
docker-compose build
docker-compose upThis command will start the project Finally, navigate to http://localhost:8888 and you should see the project being served and rendered locally!
npm run test