Skip to content

Commit 4fcc335

Browse files
authored
Merge pull request #265 from devfeel/aicode-changelog
docs: add CHANGELOG
2 parents 6a55e51 + fd14da5 commit 4fcc335

File tree

11 files changed

+424
-27
lines changed

11 files changed

+424
-27
lines changed

.gitignore

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Binaries
2+
*.exe
3+
*.exe~
4+
*.dll
5+
*.so
6+
*.dylib
7+
*.test
8+
*.out
9+
10+
# Go workspace
11+
go.work
12+
13+
# Vendor
14+
vendor/
15+
16+
# IDE
17+
.idea/
18+
.vscode/
19+
*.swp
20+
*.swo
21+
*~
22+
23+
# OS
24+
.DS_Store
25+
Thumbs.db
26+
27+
# Build output
28+
bin/
29+
dist/
30+
build/
31+
32+
# Logs
33+
*.log
34+
35+
# Uploads (example)
36+
uploads/
37+
38+
# Test coverage
39+
coverage.out
40+
41+
# Certs
42+
*.pem
43+
*.key

.travis.yml

Lines changed: 0 additions & 14 deletions
This file was deleted.

CHANGELOG.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [1.8.0] - 2026-03-01
11+
12+
### Added
13+
- GitHub Actions CI workflow
14+
- More code examples (JWT, file-upload, CORS)
15+
- ExistsRouter method to Router interface
16+
17+
### Changed
18+
- Upgrade Go version to 1.21
19+
- Upgrade dependencies
20+
- Improve README with badges and quick start guide
21+
22+
### Fixed
23+
- Issue #245: Return 404 instead of 301 for trailing slash in parameterized routes
24+
- Issue #250: Support AutoOPTIONS for route groups
25+
26+
### Removed
27+
- Deprecated Travis CI configuration
28+
29+
## [1.7.21] - 2023-04-15
30+
31+
### Added
32+
- SessionManager.RemoveSessionState
33+
- HttpContext.DestroySession()
34+
35+
## [1.7.20] - 2022-08-11
36+
37+
### Fixed
38+
- Delete minor unreachable code
39+
40+
## [1.7.19] - 2021-04-20
41+
42+
### Added
43+
- SetReadTimeout, SetReadHeaderTimeout, SetIdleTimeout, SetWriteTimeout in HttpServer
44+
45+
### Fixed
46+
- deepcopy middleware issue
47+
48+
## [1.7.18] - 2021-04-20
49+
50+
### Fixed
51+
- GetRandString returning same result

README.md

Lines changed: 56 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,66 @@
55
# DotWeb
66
Simple and easy go web micro framework
77

8-
Important: Now need go1.9+ version support, and support go mod.
8+
[![Go Version](https://img.shields.io/badge/Go-1.21+-00ADD8?style=for-the-badge&logo=go)](https://go.dev)
9+
[![GoDoc](https://pkg.go.dev/badge/github.com/devfeel/dotweb.svg)](https://pkg.go.dev/github.com/devfeel/dotweb)
10+
[![Go Report Card](https://goreportcard.com/badge/github.com/devfeel/dotweb)](https://goreportcard.com/report/github.com/devfeel/dotweb)
11+
[![Test](https://github.com/devfeel/dotweb/actions/workflows/ci.yml/badge.svg)](https://github.com/devfeel/dotweb/actions)
12+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
13+
[![Release](https://img.shields.io/github/v/release/devfeel/dotweb)](https://github.com/devfeel/dotweb/releases)
14+
[![Stars](https://img.shields.io/github/stars/devfeel/dotweb?style=social)](https://github.com/devfeel/dotweb/stargazers)
15+
16+
> A lightweight, fast and easy-to-use Go web framework
917
10-
Document: https://www.kancloud.cn/devfeel/dotweb/346608
18+
### Quick Start
1119

12-
Guide: https://github.com/devfeel/dotweb/blob/master/docs/GUIDE.md
20+
```go
21+
package main
22+
23+
import (
24+
"fmt"
25+
"github.com/devfeel/dotweb"
26+
)
1327

28+
func main() {
29+
app := dotweb.New()
30+
31+
app.HttpServer.GET("/hello", func(ctx dotweb.Context) error {
32+
return ctx.WriteString("Hello, World!")
33+
})
34+
35+
fmt.Println("Server starting on :8080")
36+
app.StartServer(8080)
37+
}
38+
```
39+
40+
```bash
41+
go run main.go
42+
# Visit http://localhost:8080/hello
43+
```
44+
45+
### Installation
46+
47+
```bash
48+
go get github.com/devfeel/dotweb
49+
```
50+
51+
### Key Features
52+
- **Router**: Static, parameterized, and grouped routes
53+
- **Middleware**: App, Group, and Router level middleware
54+
- **Session**: Built-in session with Redis support
55+
- **Cache**: Multiple cache providers
56+
- **WebSocket**: Full WebSocket support
57+
- **TLS**: Built-in HTTPS support
58+
- **Hot Reload**: Development mode with auto-reload
59+
60+
### Documentation
61+
- [中文文档](https://www.kancloud.cn/devfeel/dotweb/346608)
62+
- [English Guide](https://github.com/devfeel/dotweb/blob/master/docs/GUIDE.md)
63+
- [Examples](https://github.com/devfeel/dotweb-example)
64+
65+
### Community
1466
[![Gitter](https://badges.gitter.im/devfeel/dotweb.svg)](https://gitter.im/devfeel-dotweb/wechat)
15-
[![GoDoc](https://godoc.org/github.com/devfeel/dotweb?status.svg)](https://godoc.org/github.com/devfeel/dotweb)
16-
[![Go Report Card](https://goreportcard.com/badge/github.com/devfeel/dotweb)](https://goreportcard.com/report/github.com/devfeel/dotweb)
17-
[![Go Build Card](https://travis-ci.org/devfeel/dotweb.svg?branch=master)](https://travis-ci.org/devfeel/dotweb.svg?branch=master)
18-
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=836e11667837ad674462a4a97fb21fba487cd3dff5b2e1ca0d7ea4c2324b4574"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Golang-Devfeel" title="Golang-Devfeel"></a>
67+
<a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=836e11673837ad674462a4a97fb21fba487cd3dff5b2e1ca0d7ea4c2324b4574"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Golang-Devfeel" title="Golang-Devfeel"></a>
1968
## 1. Install
2069

2170
```

core/state.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const (
2020
defaultCheckTimeMinutes = 10
2121
)
2222

23+
// GlobalState is a global instance of ServerStateInfo for testing
24+
var GlobalState = NewServerStateInfo()
25+
2326
// NewServerStateInfo return ServerStateInfo which is init
2427
func NewServerStateInfo() *ServerStateInfo {
2528
state := &ServerStateInfo{

example/README.md

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,63 @@
1-
# DotWeb
2-
Simple and easy go web micro framework
1+
# DotWeb Examples
32

4-
More examples: https://github.com/devfeel/dotweb-example
3+
This directory contains various examples demonstrating dotweb features.
54

6-
## Contact Us
7-
#### QQ-Group:193409346 - <a target="_blank" href="http://shang.qq.com/wpa/qunwpa?idkey=836e11667837ad674462a4a97fb21fba487cd3dff5b2e1ca0d7ea4c2324b4574"><img border="0" src="http://pub.idqqimg.com/wpa/images/group.png" alt="Golang-Devfeel" title="Golang-Devfeel"></a>
8-
#### Gitter:[![Gitter](https://badges.gitter.im/devfeel/dotweb.svg)](https://gitter.im/devfeel-dotweb/wechat)
5+
## Available Examples
6+
7+
### 1. Basic Usage
8+
Simple web server setup with routing.
9+
10+
```go
11+
// See main.go
12+
```
13+
14+
### 2. JWT Authentication
15+
Demonstrates JWT token-based authentication.
16+
17+
```go
18+
// See jwt/main.go
19+
```
20+
21+
Run:
22+
```bash
23+
cd jwt
24+
go run main.go
25+
```
26+
27+
### 3. File Upload
28+
Shows how to handle file uploads.
29+
30+
```go
31+
// See file-upload/main.go
32+
```
33+
34+
Run:
35+
```bash
36+
cd file-upload
37+
go run main.go
38+
```
39+
40+
### 4. CORS
41+
Cross-Origin Resource Sharing configuration.
42+
43+
```go
44+
// See cors/main.go
45+
```
46+
47+
Run:
48+
```bash
49+
cd cors
50+
go run main.go
51+
```
52+
53+
## Running Examples
54+
55+
```bash
56+
# Run any example
57+
cd example/<name>
58+
go run main.go
59+
```
60+
61+
## More Examples
62+
63+
Visit [dotweb-example](https://github.com/devfeel/dotweb-example) for more complete examples.

example/cors/main.go

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
6+
"github.com/devfeel/dotweb"
7+
)
8+
9+
// CORS Example
10+
// This demonstrates how to handle Cross-Origin Resource Sharing (CORS)
11+
12+
func main() {
13+
// init DotApp
14+
app := dotweb.New()
15+
16+
// API endpoint with CORS headers
17+
app.HttpServer.GET("/api/data", func(ctx dotweb.Context) error {
18+
// Set CORS headers
19+
ctx.Response().Header().Set("Access-Control-Allow-Origin", "*")
20+
ctx.Response().Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
21+
ctx.Response().Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
22+
23+
return ctx.WriteJson(map[string]interface{}{
24+
"message": "Hello from API",
25+
"data": []string{"item1", "item2", "item3"},
26+
})
27+
})
28+
29+
// POST endpoint
30+
app.HttpServer.POST("/api/data", func(ctx dotweb.Context) error {
31+
// Set CORS headers
32+
ctx.Response().Header().Set("Access-Control-Allow-Origin", "*")
33+
ctx.Response().Header().Set("Access-Control-Allow-Methods", "GET, POST, PUT, DELETE, OPTIONS")
34+
ctx.Response().Header().Set("Access-Control-Allow-Headers", "Content-Type, Authorization")
35+
36+
return ctx.WriteJson(map[string]string{
37+
"status": "success",
38+
"message": "Data received",
39+
})
40+
})
41+
42+
fmt.Println("CORS Example server starting on :8080")
43+
fmt.Println("API endpoint: GET /api/data")
44+
fmt.Println("API endpoint: POST /api/data")
45+
fmt.Println("Test with: curl -H 'Origin: *' http://localhost:8080/api/data")
46+
err := app.StartServer(8080)
47+
fmt.Println("server error => ", err)
48+
}

0 commit comments

Comments
 (0)