diff options
Diffstat (limited to 'src/main.v')
-rw-r--r-- | src/main.v | 33 |
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 ) + +} |