Language: golang:1.7
Required packages: github.com/gorilla/mux, gopkg.in/mgo.v2
Software tool: Docker
Before the back-end sever is run, in addition to satisfy software requirements, make sure the following conditions are also met:
-
Have at least one mongo database available with public access.
-
If a mongo cluster is desired, make sure they have proper replica configuration.
-
Modify three variables in server.go, mongo1, mongo2, mongo3, to have those addresses.
-
For more detail how to create a mongo cluster, visit the page:
https://github.com/azhadm/multi-tenant-starbucks/blob/master/Mongo/README.md
-
After installing Golang and required packages, go to directory where sever.go is located and run the following command :
go run sever.go
-
Visit design document to see available apis:
https://github.com/azhadm/multi-tenant-starbucks/blob/master/Khoa.Restbucks/design/starbucks.pdf
-
Test can be done using Curl or Postman tool with address localhost:9090.
- After installing Docker, go to directory where Dockerfile is located and build an image.
docker build -t <image_name> .
docker build -t KhoaRestBuck .
-
To check if the image is built successfully, run the following command and look for your <image_name>.
docker images
-
Run the docker image:
docker run -it --rm -p 9090:9090 <image_name>
docker build -it --rm -p 9090:9090 KhoaRestBuck
- Test can be done using Curl or Postman tool with address localhost:9090.