This is a sample RESTful API project with typescript that integrates with the Billboard API to get the TOP 1 song on an specific date with an Youtube Video of the song!
- Web server with express
- Unit and functional end-2-end tests with Jest
- Code stylezation and formating with Prettier
- Static code analysis with ESLint
- CI/CD with GitHub Actions workflow
- Configurable MongoDB database connection with mongoose
git clone https://github.com/viniciuslunardi/billboard-birthday.git
cd billboard-birthday
npm install
Run application
npm run start
Run tests
npm run test
npm run test:unit
npm run test:functional
Run linter
npm run lint
npm run lint:fix
Run prettier
npm run style:check
npm run style:fix
Run build
npm run build
Usage example:
curl --location --request GET 'localhost:3000/api/billboard-birthday/top-hundred?date=2000-02-06'
- Date must be in YYYY-MM-DD format!
Response:
{
"artist": "Savage Garden",
"title": "I Knew I Loved You",
"peak_position": "1",
"weeks_at_num_1": "3",
"rank": "1",
"weeks_on_chart": "17",
"youtube": {
"title": "Savage Garden - I Knew I Loved You (Official Video)",
"link": "https://www.youtube.com/watch?v=jjnmICxvoVY"
}
}
env | value |
---|---|
PORT | 3000 |
BILLBOARD_KEY | 'secret-cat' |
GOOGLE_APY_KEY | 'secret-cat' |
SKIP_DATABASE_CONNECTION | true/false |
MONGO_USER | foo-bar |
MONGO_PASSWORD | foo-bar |
MONGO_DATABASE | billboard-birthday |
MONGO_HOST | localhost |
MONGO_PORT | 27017 |
TESTING | true/false |
- As the current state of this application does not need an Database connection, you can skip this part with the SKIP_DATABASE_CONNECTION enviroment variable.
- The TESTING enviroment variable is used to connect with the cluster Database connection on MongoDB Atlas, when this application go to production enviroment
- Locally, you will need an API key from the Billboard API and and Google API key to test this application. Set them to the BILLBOARD_KEY and GOOGLE_APY_KEY enviroment variable repectively.