Refactor router and storage

* Split and extract data-logic from application level
* Move storage to DeeSee package
* Move router into internal package
* Fix Makefile
* Fix documentation
* Fix tests
This commit is contained in:
2023-02-08 17:44:58 +00:00
parent 2cfe36590f
commit c60839bcfb
7 changed files with 135 additions and 56 deletions

View File

@@ -1,24 +1,26 @@
DIST_NAME=superhero
DIST_PATH=dist
PACKAGE_PATH=github.com/eslider/superherohub
DIST_NAME ?=deesee-superhero-service
DIST_PATH ?=build/package
PORT ?=8080
KEY ?=5
objects =$(patsubst %.go,%.o,$(wildcard *.go))
BINARY_PATH=${DIST_PATH}/${DIST_NAME}
PACKAGE_PATH=github.com/eslider/superherohub
# Build the project
# Build the project service
build:
go build -o ${BINARY_PATH} ${PACKAGE_PATH}
go build -o ${BINARY_PATH} cmd/hub/main.go
# Run the project
run:
go build -o ${BINARY_PATH} ${PACKAGE_PATH}
go build -o ${BINARY_PATH} cmd/hub/main.go
${BINARY_PATH}
# Test and build the project
# Test the project
test:
go test -v -cover ${PACKAGE_PATH}/pkg/deesee
go test -v -cover ${PACKAGE_PATH}/pkg/people
go test -v -cover -count 10 ${PACKAGE_PATH}
go test -v -cover ./...
echo ${PORT}
# This test ork only by developer
# Please ignore this
@@ -29,7 +31,7 @@ test-store:
-H 'Cache-Control: no-cache' \
-H "Content-Type: application/json" \
-d '{"name":"supermans","identity":{"firstName":"Kent","lastName":"Clark"},"superpowers":["flight","strength","invulnerability"],"birthday":"1977-04-18"}' \
http://127.0.0.1:8080/superheroes
http://127.0.0.1:${PORT}/superheroes
# Clean the project
clean: