forked from iost-official/iost-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
42 lines (34 loc) · 1.18 KB
/
main.go
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
package main
import (
"github.com/iost-official/iost-api/config"
"github.com/iost-official/iost-api/controller"
"github.com/iost-official/iost-api/middleware"
"github.com/labstack/echo"
echoMiddle "github.com/labstack/echo/middleware"
)
func main() {
config.ReadConfig("")
e := echo.New()
e.Debug = true
e.HTTPErrorHandler = middleware.CustomHTTPErrorHandler
e.Use(middleware.CorsHeader)
e.Use(echoMiddle.Recover())
e.Use(echoMiddle.Logger())
// blocks
/* e.GET("/api/blocks", controller.GetBlocks) */
// e.GET("/api/block/:id", controller.GetBlockDetail)
// // transactions
// e.GET("/api/txs", controller.GetTxs)
// e.GET("/api/tx/:id", controller.GetTxnDetail)
// // accounts
// e.GET("/api/accounts", controller.GetAccounts)
e.GET("/iost-api/accounts/:id", controller.GetAccountDetail)
e.GET("/iost-api/pledge/:id", controller.GetAccountPledge)
e.GET("/iost-api/accountTx", controller.GetAccountTxs)
e.GET("/iost-api/contractTx", controller.GetContractTxs)
e.GET("/iost-api/candidates", controller.GetCandidates)
// search
// e.GET("/api/search/:id", controller.GetSearch)
// e.GET("/api/dropDatabase", controller.DropDatabase)
e.Logger.Fatal(e.Start(":" + "8002"))
}