This commit is contained in:
Владимир Фёдоров 2026-03-26 04:07:37 +07:00
parent 7b7bd3e4bb
commit cd87774380
7 changed files with 18 additions and 13 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

1
.gitignore vendored
View File

@ -25,4 +25,3 @@ go.work
go.sum go.sum
data/ data/
bin/

BIN
bin/pinned_message_macos_arm64 Executable file

Binary file not shown.

View File

@ -21,12 +21,18 @@ import (
"google.golang.org/grpc/credentials/insecure" "google.golang.org/grpc/credentials/insecure"
) )
const (
tcpPort = ":8200"
gwPort = ":8210"
clientPort = ":8220"
)
//go:embed static/user/* //go:embed static/user/*
var userFS embed.FS var userFS embed.FS
func main() { func main() {
// Create a listener on TCP port // Create a listener on TCP port
lis, err := net.Listen("tcp", ":8080") lis, err := net.Listen("tcp", tcpPort)
if err != nil { if err != nil {
log.Fatalln("Failed to listen:", err) log.Fatalln("Failed to listen:", err)
} }
@ -55,7 +61,7 @@ func main() {
), ),
) )
// Serve gRPC server // Serve gRPC server
log.Println("Serving gRPC on 0.0.0.0:8080") log.Println("Serving gRPC on 0.0.0.0" + tcpPort)
go func() { go func() {
log.Fatalln(s.Serve(lis)) log.Fatalln(s.Serve(lis))
}() }()
@ -63,7 +69,7 @@ func main() {
// Create a client connection to the gRPC server we just started // Create a client connection to the gRPC server we just started
// This is where the gRPC-Gateway proxies the requests // This is where the gRPC-Gateway proxies the requests
conn, err := grpc.NewClient( conn, err := grpc.NewClient(
"0.0.0.0:8080", "0.0.0.0"+tcpPort,
grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithTransportCredentials(insecure.NewCredentials()),
) )
if err != nil { if err != nil {
@ -78,12 +84,12 @@ func main() {
} }
gwServer := &http.Server{ gwServer := &http.Server{
Addr: ":8090", Addr: gwPort,
Handler: cors(gwmux), Handler: cors(gwmux),
} }
// Serve gRPC-Gateway server // Serve gRPC-Gateway server
log.Println("Serving gRPC-Gateway on http://0.0.0.0:8090") log.Println("Serving gRPC-Gateway on http://0.0.0.0" + gwPort)
go func() { go func() {
log.Fatalln(gwServer.ListenAndServe()) log.Fatalln(gwServer.ListenAndServe())
}() }()
@ -97,8 +103,8 @@ func main() {
muxUser.Handle("/", fileServerUser) muxUser.Handle("/", fileServerUser)
// Serve admin web server // Serve admin web server
log.Println("Serving user web on http://0.0.0.0:8100") log.Println("Serving user web on http://0.0.0.0" + clientPort)
log.Fatalln(http.ListenAndServe(":8100", muxUser)) log.Fatalln(http.ListenAndServe(clientPort, muxUser))
} }
func cors(h http.Handler) http.Handler { func cors(h http.Handler) http.Handler {

View File

@ -1 +1 @@
import{_ as o,c as s,a as t,o as a}from"./index-4kR8eUDl.js";const n={},c={class:"about"};function r(_,e){return a(),s("div",c,e[0]||(e[0]=[t("h1",null,"This is an about page",-1)]))}const l=o(n,[["render",r]]);export{l as default}; import{_ as o,c as s,a as t,o as a}from"./index-BGbuJmjp.js";const n={},c={class:"about"};function r(_,e){return a(),s("div",c,e[0]||(e[0]=[t("h1",null,"This is an about page",-1)]))}const l=o(n,[["render",r]]);export{l as default};

View File

@ -5,7 +5,7 @@
<link rel="icon" href="/favicon.ico"> <link rel="icon" href="/favicon.ico">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Vite App</title> <title>Vite App</title>
<script type="module" crossorigin src="/assets/index-4kR8eUDl.js"></script> <script type="module" crossorigin src="/assets/index-BGbuJmjp.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-8MK_B0RW.css"> <link rel="stylesheet" crossorigin href="/assets/index-8MK_B0RW.css">
</head> </head>
<body> <body>