From 34ede08237ee993bf0ddfe9c23994bd866a794e9 Mon Sep 17 00:00:00 2001 From: SuperSimpleDev Date: Tue, 30 Apr 2024 00:02:10 -0400 Subject: [PATCH] 18d Solution --- 2-copy-of-code/lesson-18/lesson18.html | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/2-copy-of-code/lesson-18/lesson18.html b/2-copy-of-code/lesson-18/lesson18.html index 94c1e3b..cd857df 100644 --- a/2-copy-of-code/lesson-18/lesson18.html +++ b/2-copy-of-code/lesson-18/lesson18.html @@ -22,12 +22,30 @@ }); */ + /* async function getGreeting() { const response = await fetch('https://supersimplebackend.dev/greeting'); const text = await response.text(); console.log(text); } getGreeting(); + */ + + async function postGreeting() { + const response = await fetch('https://supersimplebackend.dev/greeting', { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify({ + name: 'SuperSimpleDev' + }) + }); + + const text = await response.text(); + console.log(text); + } + postGreeting(); \ No newline at end of file