Adding mock server for simple projects

This commit is contained in:
gfleury
2020-03-18 15:20:48 -03:00
parent aabce9f497
commit 14d4b869a5
13 changed files with 7296 additions and 5 deletions

View File

@ -0,0 +1,25 @@
# Go API Server for swagger
Bitbucket Server API (former stash).
## Overview
This server was generated by the [swagger-codegen]
(https://github.com/swagger-api/swagger-codegen) project.
By using the [OpenAPI-Spec](https://github.com/OAI/OpenAPI-Specification) from a remote server, you can easily generate a server stub.
-
To see how to make this your own, look here:
[README](https://github.com/swagger-api/swagger-codegen/blob/master/README.md)
- API version: 1.0.0
- Build date: 2020-03-18T00:40:49.792Z
### Running the server
To run the server, follow these simple steps:
```
go run main.go
```

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,32 @@
/*
* Bitbucket Server API
*
* Bitbucket Server API (former stash).
*
* API version: 1.0.0
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package swagger
import (
"log"
"net/http"
"time"
)
func Logger(inner http.Handler, name string) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
start := time.Now()
inner.ServeHTTP(w, r)
log.Printf(
"%s %s %s %s",
r.Method,
r.RequestURI,
name,
time.Since(start),
)
})
}

View File

@ -0,0 +1,15 @@
package swagger
import (
"fmt"
"log"
"net/http"
)
func RunServer(port int) error {
log.Printf("Mock Server started")
router := NewRouter()
return http.ListenAndServe(fmt.Sprintf(":%d", port), router)
}

File diff suppressed because it is too large Load Diff