How to connect golang with react code

I have name, mail and message sections in my project, I made these sections with react, how can I do this with golang to get mails that I will do with golang in the backend?

For a correct use of React + Golang see this. You have to be more precise about what do you exactly want to do with info you’re sending to backend:

  • do you want save info in db?
  • do you want only send them with an smtp service?
  • do you…whatever you want

I want to save to database

I’ve written a very fast snippet for you (the server that takes data, creates the db and saves data) of course you can add any handler you want and upgrade everything.

why am i getting these errors how do i import
main.go:10:2: no required module provides package github.com/mattn/go-sqlite3: go.mod file not found in current directory or any parent directory; see ‘go help modules’

Run go mod init mailservice in order to create a module named mailservice (for example), then go get ./.... Eventually go mod tidy to update all dependency reequirements. Then compile all with go run . To correctly manage dependencies you need to define a module and the go tool will do all the work for you with the simple commands over there.

1 Like