mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-07-17 05:58:10 +00:00
Created Examples (markdown)
parent
a912a15f15
commit
bb3ecbe5be
24
Examples.md
Normal file
24
Examples.md
Normal file
|
@ -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");
|
||||
}
|
||||
})
|
||||
;
|
||||
```
|
Loading…
Reference in New Issue
Block a user