[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-09 Thread Amnon Baron Cohen
Also worth adding some unit tests, including one which reproduces your 404 
error.

See https://www.youtube.com/watch?v=hVFEV-ieeew for a great video about how 
to 
add these tests.

On Monday, 9 March 2020 14:53:20 UTC, anderso...@blacklane.com wrote:
>
> please post the code as text. Either in a github/whatever repo or here, 
> but please, as text and a runnable code.
>
> I don't see you registering any handler for */register.html*, you have 
> one for */register* only. Also if the method is not POST, you should 
> return *405 Method Not Allowed *instead of 
>
> *404 Not Found.*
> As tip, use the http constants such as http.MethodPost. See them here: 
> https://golang.org/pkg/net/http/#pkg-constants
>
> Best,
> Anderson
>
> On Sunday, 8 March 2020 16:19:20 UTC+1, Ali Hassan wrote:
>>
>> [image: goSnippet.JPG][image: firefox.JPG]
>>
>> [image: xhrSnippet.JPG]
>> [image: htmlSnippnet.JPG]Browser Error 404   please help me resolve this 
>> error. I think this is because of html page but when try this 
>> /register.html then whole page display on my console. I will exchange my 
>> data 
>>
>>
>> [image: buttonSnippnet.JPG]
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/983f155b-947a-4b65-8475-613c856af096%40googlegroups.com.


[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-09 Thread anderson . queiroz
please post the code as text. Either in a github/whatever repo or here, but 
please, as text and a runnable code.

I don't see you registering any handler for */register.html*, you have one 
for */register* only. Also if the method is not POST, you should return *405 
Method Not Allowed *instead of 

*404 Not Found.*
As tip, use the http constants such as http.MethodPost. See them here: 
https://golang.org/pkg/net/http/#pkg-constants

Best,
Anderson

On Sunday, 8 March 2020 16:19:20 UTC+1, Ali Hassan wrote:
>
> [image: goSnippet.JPG][image: firefox.JPG]
>
> [image: xhrSnippet.JPG]
> [image: htmlSnippnet.JPG]Browser Error 404   please help me resolve this 
> error. I think this is because of html page but when try this 
> /register.html then whole page display on my console. I will exchange my 
> data 
>
>
> [image: buttonSnippnet.JPG]
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/8843ec1c-d0e0-4e5e-b184-51d531a9525a%40googlegroups.com.


[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-08 Thread leszek . kubik
Hello,

It would be much clearer if you posted a complete sample of a Go code. 
Which framework are you using for the server? I guess it could be something 
with the server config, can it accept POST methods? Did you test the server 
first, independently of your frontend, by using curl or PostMan? It could 
be a problem with preflight request from the browser. 

The screenshot of the console is too small to read. 

/Leszek

On Sunday, March 8, 2020 at 4:19:20 PM UTC+1, Ali Hassan wrote:
>
> [image: goSnippet.JPG][image: firefox.JPG]
>
> [image: xhrSnippet.JPG]
> [image: htmlSnippnet.JPG]Browser Error 404   please help me resolve this 
> error. I think this is because of html page but when try this 
> /register.html then whole page display on my console. I will exchange my 
> data 
>
>
> [image: buttonSnippnet.JPG]
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/7dc12419-8f9c-43ea-8acb-0f8109fcac8b%40googlegroups.com.


[go-nuts] Re: I'm writing my website in golang but there is issue called 404 page not found

2020-03-08 Thread Brian Candler
Well, I can't see your problem immediately, but you've not made it easy for 
anyone to help you.

Am I going to retype your screen images to replicate the problem? No.  Am I 
going to write a main() function which wraps your code, and then work out 
what all the import statements need to be to make it complete? No.

Therefore, I suggest the best way to get help is to produce a standalone 
application which replicates the problem, and submit it in *text* format, 
so it's something we can simply copy-paste into a terminal, run and debug.

It doesn't need the HTML or Javascript parts - it's fine to use 'curl -X 
POST ...' to send a message to it.

Regards,

Brian.

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/b0578bee-1c38-4f88-bea1-6e672fddc089%40googlegroups.com.