JeffDeCola/my-go-examples

View on GitHub
architectures/blockchain/single-node-blockchain-with-REST/routes.go

Summary

Maintainability
A
0 mins
Test Coverage
// my-go-examples single-node-blockchain-with-REST routes.go

package main

import "net/http"

// Route - The struct for the route endpoints (e.g. /jeff)
type Route struct {
    RouteName        string
    RouteHTTPVerb    string
    RouteEndPoint    string
    RouteHandlerFunc http.HandlerFunc
}

// Routes is slice
type Routes []Route

var routes = Routes{
    Route{
        "GetIndex",
        "GET",
        "/",
        rootHandler,
    },
    Route{
        "ShowBlock",
        "GET",
        "/showblock/{blockID}",
        showBlockHandler,
    },
    Route{
        "AddBlock",
        "POST",
        "/addblock",
        addBlockHandler,
    },
}