Boxmeup is a web and mobile application to help users keep track of what they have in their containers and how to find items in specific containers.
- Go >= 1.8.1 - For local development
- Docker 17.05.0-ce+ - For building and running in docker containers
cp docker-compose-dev.yml docker-compose.ymlModify the docker compose file to suit needs.
docker-compose up -dBring your own mysql:
docker run -p 8080:8080 -e MYSQL_DSN=username:password@host:port/database cjsaylor/boxmeup-goSee .env.sample for available configurations.
In order to run tests you will need to prepare your MySQL db by running the schema.sql on the MySQL db you plan to use. If you use the docker provided MySQL image specified in the docker-compose.yml file, you can run (on the running server):
# For local development
cat schema.sql | docker exec -i $(docker-compose ps -q mysql) mysql boxmeup -u boxmeup -pboxmeup
# For running unit tests
cat schema.sql | docker exec -i $(docker-compose ps -q mysql) mysql bmu_test -u root -psupersecretCreate a user:
curl -X POST \
http://localhost:8080/api/user/register \
-H 'content-type: multipart/form-data' \
-F email=test@test.com \
-F password=test1234Obtain a json-webtoken (for use in subsequent requests to the API):
curl -X POST \
http://localhost:8080/api/user/login \
-H 'content-type: multipart/form-data' \
-F email=test@test.com \
-F password=test1234This will yield a token:
{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1MDQ5NTY5NjYsImlkIjoxLCJuYmYiOjE1MDQ1MjQ5NjYsInV1aWQiOiI5Yzk1MWIyNi05MGU1LTExZTctOTY0Ny0wMjQyYWMxMjAwMDIifQ.mgumlN4hQ5Wq3lmK1uiO9tAX21UOv7kLx5MYFI9KcdA"
}Use the token in the header of further API requests (cURL example):
-H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE0OTU1NTI1MzgsImlkIjoyLCJuYmYiOjE0OTUxMjA1MzgsInV1aWQiOiJkMjU1MzY5OC0zYmRjLTExZTctYTU0NC0wODAwMjdkNGZkMjgifQ.ccSUP9AOrBplbwBs6e8dpTpePXHLipBSHvnYL1gFalw'Dependencies are committed into the repo via godeps, so no go install required.
To build: go build -o server ./bin
To add a dependency:
go get godepgo get <pkg>- Use it somewhere in the code.
godep save