wip: add api auth and /resume endpoint
This commit is contained in:
parent
22e2f6005f
commit
aaec8ec08d
23 changed files with 1244 additions and 271 deletions
25
internal/delivery/http/v1/usage.go
Normal file
25
internal/delivery/http/v1/usage.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package v1
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func (h *Handler) getUsage(c *gin.Context) {
|
||||
c.Writer.Header().Set("Content-Type", "text/plain")
|
||||
message := fmt.Sprintf(`
|
||||
Hello! If you're seeing this message it means you are authorized to view my CV.
|
||||
You should have been provided an api key in order to query the different endpoints,
|
||||
which are not public. You can put the key into a X-API-KEY header or use it
|
||||
as a query param. Examples:
|
||||
|
||||
curl %s/api/v1/usage -H "X-API-KEY: verysecret"
|
||||
|
||||
curl %s/api/v1/usage?api_key=verysecret
|
||||
|
||||
`, c.Request.Host, c.Request.Host)
|
||||
|
||||
c.String(http.StatusOK, message)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue