The Chirpy app is a Twitter-like server that connects to a PostgreSQL database.
The web server is written in Go. It is a lighweight and efficient server that uses Go's standard
net/http library to handle requests with ease. It was designed for handling RESTful API requests, and
managing user data. It leverages PostgreSQL as the backend database to ensure robust and reliable data storage. The interface
between the two is generated using SQLC.
- Go must be installed (download it from golang.org.
- Ensure your
$GOPATH/binis in your sytem'sPATH. - PostgreSQL must be installed (download it using your preferred package manager)
- Run all the migrations in your database (Goose makes this extremely easy).
Run the following command to install the binary globally:
go install github.com/tsyrdev/chirpyOnce installed, you can run the server using chirpy
- Clone the repo:
git clone https://github.com/tsyrdev/chirpy.git
cd chirpy- Build the project:
go build -o chirpy - Run the tool locally:
./chirpy- If you want to run it globally, move the binary to your
$GOPATH/bin:
mv chirpy ~/go/binThe chirpy server exposes the following endpoints for users to connect to:
POST /admin/reset- Resets the users in the database.GET /api/healthz- Returns the status of the server.POST /api/users- Creates a new user.POST /api/chirps- Creates a new chirp.GET /api/chirps- Gets all the chirps in the database.GET /api/chirps/{chirpID}- Gets the specified chirp.DELETE /api/chirps/{chirpID}- Deletes the specified chirp.POST /api/login- Logs into a user account.POST /api/revoke- Revokes a user's access token.PUT /api/users- Updates a user's credentials.POST /api/polka/webhooks- Third-party connection for users to upgrade their membership.
This project is from a Go Servers tutorial on boot.dev
This project is licensed under the MIT License