summaryrefslogtreecommitdiff
path: root/src/main.v
diff options
context:
space:
mode:
authorIndrajith K L2023-08-09 03:22:12 +0530
committerIndrajith K L2023-08-09 03:22:12 +0530
commitaf7ae10020cb6092f0491435ba43f3c09da663a4 (patch)
tree8cd5d96ca99cf678f4158b74966588c0f051ed09 /src/main.v
downloadJournlr Frontend-af7ae10020cb6092f0491435ba43f3c09da663a4.tar.gz
Journlr Frontend-af7ae10020cb6092f0491435ba43f3c09da663a4.tar.bz2
Journlr Frontend-af7ae10020cb6092f0491435ba43f3c09da663a4.zip
Initial CommitHEADmaster
* Working Post API integrated
Diffstat (limited to 'src/main.v')
-rw-r--r--src/main.v33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/main.v b/src/main.v
new file mode 100644
index 0000000..4775e50
--- /dev/null
+++ b/src/main.v
@@ -0,0 +1,33 @@
+module main
+import net.http
+import json
+import time
+struct ResponseStruct {
+ id int
+ text string
+}
+
+struct PostResp {
+ success string
+}
+
+struct RequestStruct {
+ date time.Time
+ journal_data string
+}
+
+fn main() {
+ println('Hello World!')
+ payload := json.encode(RequestStruct{date: time.now(), journal_data: 'My First Journal'})
+ resp := http.post_json('http://localhost:3000', payload) or {
+ println('Failed to FETCH API')
+ return
+ }
+
+ resp_data := json.decode(PostResp, resp.body) or {
+ println('Failed to Decode the data')
+ return
+ }
+ println(resp_data )
+
+}