-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (36 loc) · 829 Bytes
/
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
package main
import (
"github.tools.sap/atom-cfs/mock-api/utils"
"log"
"net/http"
"sync"
)
var (
tests map[string]*utils.MockConfig
mutex *sync.Mutex
)
func main() {
tests = make(map[string]*utils.MockConfig)
mutex = &sync.Mutex{}
log.Printf("starting mock server")
/*
POST:
Create a new test configuration, using MockConfig struct
Response will contain the ID of the test config
DELETE:
Optional flags:
* all=true: delete all test configurations
* id=uuid: delete single test configuration
*/
http.HandleFunc("/mockConfig", setup)
/*
Mandatory flag:
* id=testUUID: with define which test config to work with
POST:
Execute create with the test config
DELETE:
Execute delete with the test config
*/
http.HandleFunc("/", handler)
log.Fatal(http.ListenAndServe(":8080", nil))
}