This app is just mean to be an API collection of different interfaces.
- Will have a basic RESTful API structure
- Inclues JWT Authentication
- Searching
- Caching
Essentially, There will be a catalog of products that anyone can view. They'll also be able to search the products catalog. A client will then be able to create a user profile and from there will then be able to create/edit/delete a product.
You can run the command to spin up a new docker instance of Reids. This will add a default Redis instance with no password (should be setup through the env var).
docker run --name go-api-redis -p 6379:6379 -d redisYou can run the tests via the go command
go test -v ./...GET /indexGET /healthcheckhealthcheckGET /api/productslist of all productsCREATE /api/productsCreates a new productGET /api/products/:product_idGets a detailed description of a productPUT /api/products/:product_idUpdates the productDELETE /api/products/:product_idDeletes the productCREATE /api/userscreates a new userGET /api/users/:user_idView user informationPUT /api/users/:user_idUpdates the userCREATE /api/sessionsLogs in the user
This is a very basic and messy api system. I more wanted to showcase the overall theme. There are some nice-to-haves that I want to build
- Need to figure out some sort of middleware for the api. Quite a bit of things are repeated.
- It's the the best, I need to figure out if there's a better way to implement a middleware function.
- Need to better sanitize these queries. Right now they can be infected with SQL injection.
- Want to introduce a centralized config file. This is where the env vars can be initialized and missing, it will not start. This will prevent some false-positives.
- GitHub Actions tests are currently failing because there is currently no setup for the database to utilize the app. Add config settings to build/use/connect psql.