Shopping Cart service provides implementation of below.
- Ability to create account with two roles (admin, user) and log in
Admin should be able to
- Add items
- Suspend user
User should be able to
- List available items
- Add items to a cart (if there are items in stock)
- Remove items from their cart
-
Install Go on your local machine. You will also need
Postgres
running locally. -
git clone git@github.com:akashgupta05/shopping-cart-go.git
-
Create a dev environment file
cp env.sample development.env
Edit values in
development.env
to match your needs -
Run Migrations
-
Install golang-migrate tool
brew install golang-migrate
-
Create database
createdb shopping_cart_go_development
-
Use helper bash script to run migrations
./scripts/migrations.sh
-
-
Run Tests
- Create database
createdb shopping_cart_go_test
-
Use helper bash script to run migrations
./scripts/migrations.sh
-
Use helper bash script to run tests
./scripts/run_tests.sh
-
Install
gin
. This is needed for live-reload during developmentGOBIN=/usr/local/bin/ go install github.com/codegangsta/gin
-
Use helper bash script to run server locally
./scripts/local_run.sh