Hi,
I am new in Nim Language. I want to create simple web server, and now i have a problem to get value that posted by client. Here is my code :
routes:
post "/save-log":
var sbj = @"subject"
var rpt = @"reporter"
var dte = @"report_date"
var dtl = @"detail"
echo "Subject is : " & sbj
echo "Reporter is : " & rpt
echo "Reported at : " & dte
echo "Log Detail : " & dtl
resp "saved!"
runForever()
There is no error while that code is running, but after i tried to post, the result that i get is
Subject is :
Reporter is :
Reported at :
Log Detail :
saved!
Can you show me what i miss in my code?
Thank you for your help.
Hello!
The code looks correct.
How are you making the POST request to your web application?
Hi, dom96.
Thank you for replying.
I use POST method from Postman in Chrome Apps. I have set proper URL, key , and value for POST request.
Holy GOD!
I just make simple html page for POST request, and it works fine.
Maybe any differences between make a POST request from postman and html page.
Check the headers. Should have something like: Content-Type: application/x-www-form-urlencoded.
Maybe related:
Yeah, that is the reason. I have to add Content-type on postman, so i can get proper output.
Thank you OderWat for your explanation.