const promise = fetch(url, [, options])
fetch('<https://jsonplaceholder.typicode.com/todos/1>')
	.then(response => console.log(response));

//첫 번째 인수로 HTTP 요청을 전송할 URL만 전달하여 GET 요청을 전송
const request = {
    get(url) {
        return fetch(url);
    },
    post(url, payload) {
        return fetch(url, {
            method: 'POST',
            headers: { 'content-Type': 'application/json' },
            body: JSON.stringify(payload)
        });
    },
    patch(url, payload) {
        return fetch(url, {
            method: 'PATCH',
            headers: { 'content-Type': 'application/json' },
            body: JSON.stringify(payload)
        });
    },
    delete(url) {
        return fetch(url, { method: 'DELETE' });
    }
};

- GET 요청

request.get('<https://jsonplaceholer.typicode.com/todos/1>')
	.then(response => response.json())
	.then(todos => console.log(todos))
	.catch(err => console.log(err))

- POST 요청

request.post('<https://jsonplaceholder.typicode.com/todos>', {
	userId: 1,
	title: 'JavaScript',
	completed: false
}).then(response => response.json())
	.then(todos => console.log(todos))
	.catch(err => console.log(err))

- PATCH 요청