A simple web API built with Beego v2 and Go 1.20+.
It includes rate limiting, XSRF protection, and a styled frontend for testing API endpoints.
- REST Endpoints (
/hello
,/time
,/post
) - CSRF/XSRF Protection
- Custom Rate Limiting (1 request/second per IP, burst capacity of 5)
- Styled Frontend Interface
- Security Headers (Content Security Policy, HSTS, etc.)
Install Go before you get started.
# Clone the repository
git clone https://github.com/vaqqq/beego-simple-api.git
# Install dependencies
go mod tidy
# Run using the Bee tool (if installed)
bee run
# OR run manually
go run main.go
Access the API in your browser:
http://localhost:8080
Method | Endpoint | Description |
---|---|---|
GET | /hello |
Returns a hello message |
GET | /time |
Returns the server time |
POST | /post |
Accepts a message via POST |
POST Body Example:
message=HelloFromFrontend
You can test all API endpoints through the built-in web interface:
http://localhost:8080/