Refactor and rename storage to Json
This commit is contained in:
@@ -15,15 +15,13 @@ import (
|
||||
// main is the entry point of the application
|
||||
func main() {
|
||||
var (
|
||||
dataPath = "data/heros.json" // store to JSON file
|
||||
dataPath = "data/heros.json" // Path to read superheros from JSON file
|
||||
port = 8080 // Port to serve
|
||||
key = 5 // DeeSee encryption key
|
||||
err error
|
||||
key = 5 // Json encryption key
|
||||
logger = log.Default() // Logger
|
||||
err error // Error
|
||||
)
|
||||
|
||||
// Create logger
|
||||
logger := log.Default()
|
||||
|
||||
// Get port from environment variable
|
||||
if os.Getenv("PORT") != "" {
|
||||
port, err = strconv.Atoi(os.Getenv("PORT"))
|
||||
@@ -54,8 +52,8 @@ func main() {
|
||||
logger.Fatalf("Invalid data path: %s", dataPath)
|
||||
}
|
||||
|
||||
// Create DeeSee storage
|
||||
s, err := storage.New(dataPath)
|
||||
// Create Json storage
|
||||
s, err := storage.NewJson(dataPath)
|
||||
if err != nil {
|
||||
logger.Fatalf("Invalid data format: %s", dataPath)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user