Skip to content
/ beego-simple-api Public template

A simple web API built with Beego v2 and Go 1.20+.

License

Notifications You must be signed in to change notification settings

vaqqq/beego-simple-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Title Image

Beego Simple API

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.

Features

  • 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.)

Get Started

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


Available Endpoints

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

Frontend Web Interface

You can test all API endpoints through the built-in web interface:
http://localhost:8080/

Built With

About

A simple web API built with Beego v2 and Go 1.20+.

Resources

License

Stars

Watchers

Forks