mirror of
https://github.com/axllent/mailpit.git
synced 2025-01-10 00:43:53 +02:00
0af11fcb28
Resolves #218
34 lines
698 B
Go
34 lines
698 B
Go
package apiv1
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
|
|
"github.com/axllent/mailpit/internal/stats"
|
|
)
|
|
|
|
// AppInfo returns some basic details about the running app, and latest release.
|
|
func AppInfo(w http.ResponseWriter, _ *http.Request) {
|
|
// swagger:route GET /api/v1/info application AppInformation
|
|
//
|
|
// # Get application information
|
|
//
|
|
// Returns basic runtime information, message totals and latest release version.
|
|
//
|
|
// Produces:
|
|
// - application/json
|
|
//
|
|
// Schemes: http, https
|
|
//
|
|
// Responses:
|
|
// 200: InfoResponse
|
|
// default: ErrorResponse
|
|
|
|
info := stats.Load()
|
|
|
|
bytes, _ := json.Marshal(info)
|
|
|
|
w.Header().Add("Content-Type", "application/json")
|
|
_, _ = w.Write(bytes)
|
|
}
|