Search by

    Terakhir diperbaharui: Oct 24, 2020

    Testing

    Setelah menambahkan route handler, saatnya kita uji API dengan menggunakan Postman.

    Buat sebuah note baru

    • Setup:

    URL: http://localhost:3001/note

    HTTP Method: POST

    create note

    • Response:

    create note response

    • MongoDB Compass:

    create note result

    Tampilkan semua note

    • Setup:

    URL: http://localhost:3001/notes

    HTTP Method: GET

    • Response:

    get all notes

    Tampilkan satu note

    • Setup:

    URL: http://localhost:3001/note/5f75d755fc5cf558be48b9d4

    HTTP Method: GET

    Note Id: 5f75d755fc5cf558be48b9d4

    • Response:

    get single note

    Update note

    • Setup:

    URL: http://localhost:3001/note/5f75d755fc5cf558be48b9d4

    HTTP Method: PUT

    Note Id: 5f75d755fc5cf558be48b9d4

    update note

    • Response:

    update note response

    • MongoDB Compass:

    update note result

    Hapus note

    • Setup:

    URL: http://localhost:3001/note/5f75d755fc5cf558be48b9d4

    HTTP Method: DELETE

    Note Id: 5f75d755fc5cf558be48b9d4

    update note

    • Response:

    delete note result

    Untuk memastikan data sudah terhapus, kita bisa cek dengan mengirim GET request untuk id note yang sudah dihapus

    note not found