From bb3ecbe5beb95c314225993d0cf928314d2b03d1 Mon Sep 17 00:00:00 2001 From: "Namhyeon, Go" Date: Tue, 10 Nov 2020 17:33:35 +0900 Subject: [PATCH] Created Examples (markdown) --- Examples.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 Examples.md diff --git a/Examples.md b/Examples.md new file mode 100644 index 0000000..08806fb --- /dev/null +++ b/Examples.md @@ -0,0 +1,24 @@ +# Examples of WelsonJS + +## HTTP Request + +``` +var HTTP = require("lib/http"); + +var credential = { + "email": document.getElementById("txt_email").value, + "password": document.getElementById("txt_password").value +}; + +HTTP.create() + .setContentType("application/json") + .setRequestBody(credential) + .post(apiUrl + "/netsolid/auth/authenticate", function(res) { + if ("error" in res) { + console.error(res.error.message); + } else if ("data" in res) { + console.log("ok"); + } + }) +; +``` \ No newline at end of file