Golang http post authen issue


(Y B S) #1

Hi all. I am new to golang. hope somebody can help me.
I post a search json to web api with key, later i need to get request again, but golang http does not have session, how could i do it? i have google for long, but i found most of answers related to server sides.


(Yamil Bracho) #2

You would need to use a storage, depending, what you need, in memory or in disk (like a file). A Map couldbe handy because you can assoicate a key with a request…


(Y B S) #3

where should i add this map variable?


(Yamil Bracho) #4

maybe, as a global var…


(George Calianu) #5

A good idea is to use a web framework or a toolkit like Gorilla wich can easy handle sessions.
:wink: