MyWins is a service to track your daily routines whatever it is, just to cheer you up in the pursuit of your dreams.
##How it works
- You should download the app form
url
and create an account. (To be done) - After you've already log in, you'll be asked to submit your success or your fail of the day.
- Keep your wins green!
##Installation
- You just
go get github.com/marcossegovia/MyWins
so you'll get the repository inside your go workspace. - Be sure to get glide to be able to get dependencies.
- If so, then run
glide install
##How to build and run it locally
- First you'll have to provide a mongodb running in your local machine. The fastest way is to provide a mongodb container with Docker by typing
docker run -P -d mongo
- We set the mongoDBPort (we can check in which port Docker is providing Mongo service by typing
docker ps
) in the config fileMyWins/config/mongo_dev.yml
like"mongoDBPort": "32770",
- We build our project to generate the binary
go build -o bin/mywins src/*.go
- We run the binary
./bin/mywins
- MyWins will be running on 0.0.0.0:8080 and 0.0.0.0:8081
##How to build and run it with Docker locally
- Build it with the Dockerfile provided
docker build -t marcossegovia/mywins .
- Run the docker-compose file like the following
docker-compose up -d mywins
- Run a
docker ps
and you'll see the app running on the 0.0.0.0:8080 and 0.0.0.0:8081 and automatically connected to a mongodb container internally with unneeded manual configuration.
##Usage
MyWins is based in the OAuth 2.0 protocol to establish communication with the api provided.
By default I've provided a default client to be able to access the different endpoints in the API. To be able to authenticate with MyWins as the default client you have two alternatives:
- Making a GET request to the endpoint
http://localhost:8081/login
and submit the form with your client credentials (client_id: 1234
client_secret: abcd
) - Making a POST Request to the endpoint
http://localhost:8081/login
with the form parameters in the request body.Example CURL request
curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -H "Cache-Control: no-cache" -d 'grant_type=client_credentials&client_id=1234&client_secret=abcd' "http://localhost:8081/login" ```
From now on you'll have access to all the endpoints of the MyWins API by using the provided token:
Just by adding the Authorization header with the Bearer Token.
Example CURL request to the endpoint /wins
using the token of the example:
curl -X GET -H "Authorization: Bearer Y_Viqe4xQBW0l-chNPiZqw" -H "Cache-Control: no-cache" "http://localhost:8080/wins"
##Roadmap
When reaching stability to release the v1.0, MyWins is going to push forward and provide friendly frontend clients to consume from different devices.
iOS app is going to take place to be able to directly get track of your current MyWins streaks !