File size: 1,379 Bytes
542878f
 
 
 
 
 
 
 
 
a1eed6b
 
542878f
a1eed6b
542878f
 
 
a1eed6b
 
 
 
 
 
 
 
 
 
 
542878f
a1eed6b
 
 
 
 
 
 
542878f
a1eed6b
 
 
 
 
 
 
542878f
 
a1eed6b
542878f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
package main

import (
	"fmt"
	"log"
	
	"github.com/gofiber/fiber/v2"

	proxy "tebakaja_lb_proxy/proxy"

	stock_proxy "tebakaja_lb_proxy/proxy/stock"
	crypto_proxy "tebakaja_lb_proxy/proxy/crypto"
	national_currency_proxy "tebakaja_lb_proxy/proxy/national_currency"
)

func main() {
	proxyService := fiber.New()
	proxyService.Use(proxy.LoggingMiddleware)
	proxyService.Use(proxy.RateLimiterMiddleware())

	stockGroup := proxyService.Group("/stock")
	stockGroup.Get("/lists",
		stock_proxy.StockListsHandler(
			&stock_proxy.StockServiceImpl{}))
	stockGroup.Post("/prediction",
		stock_proxy.StockPredictionHandler(
			&stock_proxy.StockServiceImpl{}))

	cryptoGroup := proxyService.Group("/crypto")
	cryptoGroup.Get("/lists",
		crypto_proxy.CryptoListsHandler(
			&crypto_proxy.CryptoServiceImpl{}))
	cryptoGroup.Post("/prediction",
		crypto_proxy.CryptoPredictionHandler(
			&crypto_proxy.CryptoServiceImpl{}))

	nationalCurrencyGroup := proxyService.Group("/national-currency")
	nationalCurrencyGroup.Get("/lists",
		national_currency_proxy.NationalCurrencyListsHandler(
			&national_currency_proxy.NationalCurrencyServiceImpl{}))
	nationalCurrencyGroup.Post("/prediction",
		national_currency_proxy.NationalCurrencyPredictionHandler(
			&national_currency_proxy.NationalCurrencyServiceImpl{}))

	port := 7860
	log.Fatal(proxyService.Listen(fmt.Sprintf("0.0.0.0:%d", port)))
}