This is a comprehensive guide for the "MeuPrimeiroCRUD em Go" project in Go, an example application that implements the basic CRUD (Create, Read, Update, Delete) operations for users. The project includes a Dockerfile to facilitate running it in containers.
Before getting started, make sure you have the following prerequisites installed on your system:
Follow the steps below to install the project in your development environment:
git clone https://github.com/HunCoding/meu-primeiro-crud-go.git
cd meu-primeiro-crud-go
docker compose up
After installation, you can run the MeuPrimeiroCRUD em Go application with the following command (if you want to run it directly with Golang):
docker container run --name meuprimeirocrudgo -p 27017:27017 -d mongo
go run main.go
The application will be accessible at http://localhost:8080.
If you prefer, after running the project, visit: http://localhost:8080/swagger/index.html# to see and test all the route contracts.
The MeuPrimeiroCRUD em Go application offers REST endpoints for creating, listing, updating, and deleting users. You can use tools like curl or Postman to test the endpoints. Here are some curl command examples for testing the endpoints:
curl -X POST -H "Content-Type: application/json" -d '{"name": "João", "email": "joao@example.com", "age": 30, "password": "password$#@$#323"}' http://localhost:8080/createUser
curl -X PUT -H "Content-Type: application/json" -d '{"name": "João Silva"}' http://localhost:8080/updateUser/{userId}
curl -X DELETE http://localhost:8080/deleteUser/{userID}
Remember to adjust the commands according to your needs and requirements.
Structure containing the necessary fields for user login.
email (string, required): The user's email (must be a valid email address).password (string, required): The user's password (must be at least 6 characters and contain at least one of the characters: !@#$%*).Structure containing the required fields for creating a new user.
age (integer, required): The user's age (must be between 1 and 140).email (string, required): The user's email (must be a valid email address).name (string, required): The user's name (must be at least 4 characters and at most 100 characters).password (string, required): The user's password (must be at least 6 characters and contain at least one of the characters: !@#$%*).Structure containing fields to update user information.
age (integer, required): The user's age (must be between 1 and 140).name (string, required): The user's name (must be at least 4 characters and at most 100 characters).Response structure containing user information.
age (integer): The user's age.email (string): The user's email.id (string): The user's unique ID.name (string): The user's name.Structure representing the causes of an error.
field (string): The field associated with the error cause.message (string): Error message describing the cause.Structure describing why an error occurred.
causes (array of rest_err.Causes): Error causes.code (integer): Error code.error (string): Error description.message (string): Error message.Authorization header as "Bearer " for protected endpoints.The API offers the following endpoints:
userRequest (body, required): User information for registration.Responses:
DELETE /deleteUser/{userId}
userId (path, required): ID of the user to be deleted.Responses:
GET /getUserByEmail/{userEmail}
userEmail (path, required): Email of the user to be retrieved.Responses:
GET /getUserById/{userId}
userId (path, required): ID of the user to be retrieved.Responses:
POST /login
userLogin (body, required): User login credentials.Responses:
PUT /updateUser/{userId}
userId (path, required): ID of the user to be updated.userRequest (body, required): User information for update.If you wish to contribute to the MeuPrimeiroCRUD em Go project in Go, feel free to submit pull requests or report issues on the official repository.
This project is distributed under the MIT license. Please refer to the LICENSE file for more details.
We hope this Swagger documentation has been helpful in understanding and interacting with the API of the MeuPrimeiroCRUD em Go project in Go. If you have any questions or need additional support, please don't hesitate to reach out. Enjoy using the API!
$ claude mcp add meu-primeiro-crud-go \
-- python -m otcore.mcp_server <graph>