- eslint
- eslint-config-google
- nodemon
npm init -y
npm install <package_name>
npm run start-dev
- "start-prod": "NODE_ENV=production node ./src/server.js"
- "start-dev": "nodemon ./src/server.js"
- "lint": "eslint ./src"
- "migrate": "node-pg-migrate"
├── src
│ ├── api
│ │ ├── notes
│ ├── exceptions
│ ├── services
│ ├── utils
│ ├── validator
│ │ ├── notes
│ ├── server.js
├── migration
├── node_modules
├── package.json
├── package-lock.json
└── .gitignore
- Create database openmusic
- Initialize project
- Create migrations
- Push project to GitHub
- Development
- Deploy to AWS EC2 & RDS
- Production
- Initalize project
- Install all needed dependencies
- Create database in PostgresSQL
- Create .env inside project
- Create migration files
- Create server.js
- Create handler, index, and routes JS file inside
api/notes/
- Create exception file handling inside
exceptions
- Create services for NoteService inside
services/postgres/
- Create Model inside
utils/
- Create index and schema inside
validator/notes
![[Pasted image 20230628151422.png]]
- POST
/albums
{
"status": "success",
"data": {
"albumId": "album-Mk8AnmCp210PwT6B"
}
}
- GET
/albums/{id}
{
"status": "success",
"data": {
"album": {
"id": "album-Mk8AnmCp210PwT6B",
"name": "Viva la Vida",
"year": 2008
}
}
}
- PUT
albums/{id}
{
"status": "success",
"message": "Album berhasil diperbarui"
}
- DELETE
/albums/{id}
{
"status": "success",
"message": "Album berhasil dihapus"
}
![[Pasted image 20230628161118.png]]
- POST
/songs
{
"status": "success",
"data": {
"songId": "song-Qbax5Oy7L8WKf74l"
}
}
- GET
/songs
{
"status": "success",
"data": {
"songs": [
{
"id": "song-Qbax5Oy7L8WKf74l",
"title": "Life in Technicolor",
"performer": "Coldplay"
},
{
"id": "song-poax5Oy7L8WKllqw",
"title": "Centimeteries of London",
"performer": "Coldplay"
},
{
"id": "song-Qalokam7L8WKf74l",
"title": "Lost!",
"performer": "Coldplay"
}
]
}
}
- GET
/songs/{id}
{
"status": "success",
"data": {
"song": {
"id": "song-Qbax5Oy7L8WKf74l",
"title": "Life in Technicolor",
"year": 2008,
"performer": "Coldplay",
"genre": "Indie",
"duration": 120,
"albumId": "album-Mk8AnmCp210PwT6B"
}
}
}
- PUT
/songs/{id}
{
"status": "success",
"message": "Lagu berhasil diperbarui"
}
- DELETE
/songs/{id}
{
"status": "success",
"message": "Lagu berhasil dihapus"
}
- Postman OpenMusic API V1 Test Collection dan Environment
- Import OpenMusic collection ke Postman Collection
- Import OpenMusic environment ke Postman Environment
- Test all of Endpoints use Postman Runner
- Create new role in AWS IAM
- Add permissions for EC2FullAccess and RDSFullAccess
- Login to the new account that already created
- Configure EC2 and RDS