This documentation describes the features of the Go Oportunities-api project, such as the project structure, requirements, installation and use.
- Go Oportunities it's a personal project i'm doing to solidify my skills with golang, it's a restful api with a idea of managing jo opportunities, with a good description of the vacancy.
- Golang 1.22.5
- MySQL 8
- Swag
- Make (optional)
- Docker (optional)
Obs: The following commands are being used with make, if you don't want to install them, visit the makefile in the root of the project to check the commands needed to make the api work.:
- First, clone this repository on your machine:
git clone https://github.com/CLucasrodrigues22/gooportunities.git
- Open a new terminal windows at the root of the project and create an .env based on the .env.example:
cp .env.example .env
- Specify th MySQL credentials, change the http port, through the .env created:
APP_PORT=8000
DB_HOST=yourhost
DB_PORT=yourport
DB_USER=youruser
DB_PASSWORD=yourpassword
DB_NAME=yourdbname
- Run the command to up docker containers:
make
- To run on local machine, use the command:
make run-local
Obs: For a better documentation of the api, swaggo was used, use the route on the browser:
http://youraddress:port/swagger/index.html
to view more details.
Endpoint List Openings: GET /api/v1/openings
Obs: Returns a list of all openings in JSON.
Endpoint Create New Opening: POST /api/v1/opening
Obs: Create a new opening.
Endpoint Update Opening: PUT /api/v1/opening?id={id}
Obs: Update an opening by id.
Endpoint Delete Opening: DELETE /api/v1/opening?id={id}
Obs: Delete an opening by id.
Endpoint List Only Opening: GET /api/v1/opening?id={id}
Obs: Return an opening by id in JSON.
./config
: Files for configuring and initializing the database and log definitions.../docs
: Documentation generated by swaggo../handler
: Files with business rules for requests../router
: Files with api route definition and initialization../schemas
: Files with the definition of each object's data structure.