Giter Site home page Giter Site logo

open-music-backend's Introduction

OpenMusic API v1.0.0

DevDependencies

  • eslint
  • eslint-config-google
  • nodemon

Dependencies

Installations

npm init -y npm install <package_name> npm run start-dev

Runner Scripts

  • "start-prod": "NODE_ENV=production node ./src/server.js"
  • "start-dev": "nodemon ./src/server.js"
  • "lint": "eslint ./src"
  • "migrate": "node-pg-migrate"

Folder Structures

├── src
│   ├── api
│   │   ├── notes
│   ├── exceptions
│   ├── services
│   ├── utils
│	├── validator
│	│	├── notes
│   ├── server.js
├── migration
├── node_modules
├── package.json
├── package-lock.json 
└── .gitignore

Steps-by-steps

  1. Create database openmusic
  2. Initialize project
  3. Create migrations
  4. Push project to GitHub
  5. Development
  6. Deploy to AWS EC2 & RDS
  7. Production

TO-DO

1. Development

  • 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

A. Albums Endpoint Rules

![[Pasted image 20230628151422.png]]

For more details, here is the response body structure that must be displayed on the endpoint:
  • 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"
}

B. Songs Endpoint Rules

![[Pasted image 20230628161118.png]]

For more details, here is the response body structure that must be displayed on the endpoint:
  • 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"
}

2. API Testing

3. Deployment

  • Create new role in AWS IAM
  • Add permissions for EC2FullAccess and RDSFullAccess
  • Login to the new account that already created
  • Configure EC2 and RDS

open-music-backend's People

Contributors

sincanmaulanaa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.