LittleChat API is a simple chat service that allows users to create chat sessions, send messages, and retrieve messages from a chat session. It is built using Go and the Gin web framework, and it uses a PostgreSQL database to store chat data.
- Create new chat sessions
- Send messages to a chat session
- Retrieve messages from a chat session
- Docker
- Docker Compose
To set up the LittleChat on your local machine using Docker, follow these steps:
- Clone the repository to your local machine.
- Navigate to the directory containing the
docker-compose.yml
file. - Run
docker-compose up app
to build and start the services. - The application should now be accessible on
http://localhost:8080
.
Once the server is running, you can interact with the API using the following endpoints:
GET /chat?id={chat_id}
: Retrieve messages from a given chat ID.curl -X GET "http://localhost:8080/chat?id=1"
GET /new
: Create a new chat session and receive a unique chat ID.curl -X GET "http://localhost:8080/new"
POST /send
: Send a message to a chat session.curl -X POST -H "Content-Type: application/json" -d '{"chat_id":1,"sender_id":1,"text":"Hello, World!"}' "http://localhost:8080/send"
Contributions to the LittleChat API are welcome. Please feel free to fork the repository, make changes, and submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.