Iris Go Framework + MongoDB
Iris is the fastest backend web framework for Go. It is faster than Node.js and .Net framework. Please take a look https://iris-go.com/ for the benchmark and more information.
MongoDB is a document datastore, it is storing data in JSON format. It is not storing data into table or row format.
I am assuming that you have already install Google Go, and Mongo DB. If you do not have installed Iris Framework then go to their site and check documentation.
In this tutorial, we’ll write a simple program to connect with MongoDB:
- Simple server with Iris
- Connect with MongoDB using mgo
Simple server with Iris Framework
It is very simple and only three line code to create server.
Do not forget to go get -u github.com/kataras/iris
Connect with MongoDB using mgo
First you have to install mgo using following line
go get gopkg.in/mgo.v2
To run the above code type following code into terminal and hit enter to run the server.
go run example2.go
Open browser and type http://localhost:8080/car to see the result.