Created this project for HousewareHQ-github-octernship. My design decision was pretty simple as I created golang project for the first time. In the beginning I was pretty confused while thinking about folder structure for this project. So I just tried my best. Thanks. Ps :- Sorry for the Github Flow avoidation, was working on local-repo and commited the whole project on last day in this repo.
- See PERSONAL REPO
- User Login
- Admin User adds a new User account(by providing the username & password)
- Admin User deletes an existing User account from their organization
- List all Users in their organization
- Go Fiber.
- GORM.
- PostgreSQL.
- app/
- build/
- cmd/
- configs/
- docs/
- pkg/
- platform/
- test/
- .env
- .gitignore
- Makefile
- README.md
- go.mod
- go.sum
- main.go
su -u postgres psql
CREATE DATABASE test
go mod download
sudo apt install make -y
make build
make run
At this time, you have a RESTful API server running at http://127.0.0.1:8080
. It provides the following endpoints:
POST /api/v1/user
: Register a user in database.POST /api/v1/login
: authenticates a user and generates a JWT.GET /api/v1/view/:userid
: view userGET /api/v1/all/:userid
: get all user list in org.POST /api/v1/create
: creates new org.POST /api/v1/add
: creates new user.DELETE /api/v1/delete/:userid/:orgid
: delete user.
Test APIs with Swagger.
GET /swagger/
: get all user list in org.
| id | name | created_by | created_at | updated_at |
| ------------- |:-------------:| ----------:|-----------:|-----------:|
| id | username | password | created_at | updated_at | role |
| ------------- |:-------------:| ----------:|-----------:|-----------:|-----:|
| organization_id | user_id |
| ----------------|:-------:|