how to have Go accept web requests -


I do not have the exact terminology, so stay with me.

When a request came in, ask for http://api.example.com/users/42 , Apache redirects the request to the appropriate directory.

Go in, how do I http://api.example.com/users/42 and then serve the output, like JSON? Will I use the net package and talk about port 80?

I'm sure this is very early, but I do not think I have the correct terminology, so why is it a bit difficult to see. / P>

I highly recommend teaching Wiki, especially articles, check this excellent book too. :

The basic idea is:

  package main function main () {http.HandleFunc ("/ users /", function http (. Http: //ResponseWriter, R * http. Request: {w.Write ([] byte ("hello")}) http.ListenAndServe (": 80", zero)}  

Note that the port 80 < / Code> to be root to listen.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -