Giter VIP home page Giter VIP logo

assignment3_restuoktafiandi's Introduction

Assignment 3

Cara Menggunakan

Install dependensi:

npm install

Buat database:

npx sequelize db:create

Migrate database

npx sequelize db:migrate

Seed database

npx sequelize db:seed:all

Router User

POST /users/register

Pada tab Body pilih x-www-form-url-encoded di Postman, Masukkan key email, username, dan password lalu isi valuenya.

POST /users/login

Pada tab Body pilih x-www-form-url-encoded di Postman, Masukkan key email,dan password lalu isi valuenya sesuai dengan data yg sudah di regist, maka akan ter-generate token pada respon.

Unruk mengakses Photo perlu login terlebih dahulu. Caranya Letakkan token yang didapat saat login. Pada tab Headers di tiap endpoint photos pada Postman, lalu pada key nya ketik token dan isi value dengan tokennya.

Router Photos

Mengambil seluruh data photos

GET /photos

Mengambil data photos berdasarkan id

GET /photos/:id

Membuat data photos
Pada tab Body pilih x-www-form-url-encoded di Postman, Masukkan key title, caption, dan image_url lalu isi valuenya.

POST /photos

Untuk menjalankan PUT dan DELETE akan diterapkan ketika UserId dan id yang sedang login sama. Pada tab Body pilih x-www-form-url-encoded di Postman, Masukkan key title, caption, dan image_url lalu ubah valuenya

PUT /photos/:id

Delete Photos berdasarkan id
Data akan terhapus sesuai dengan id yang dikirimkan dan sesuai dengan userId yang sedang login, jika tidak maka tidak bisa dihapus.

DELETE /photos/:id

Testing

Berikut langkah-langkahnya:

npm run db:create:test
npm run db:migrate:test
npm run test

assignment3_restuoktafiandi's People

Contributors

restuoktafiandi avatar

Watchers

 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.