iris/_examples/auth/jwt/tutorial/main.go

30 lines
663 B
Go
Raw Normal View History

package main
import (
2020-11-04 20:12:13 +01:00
"myapp/api"
"myapp/domain/repository"
"github.com/kataras/iris/v12"
)
var (
userRepo = repository.NewMemoryUserRepository()
todoRepo = repository.NewMemoryTodoRepository()
)
func main() {
if err := repository.GenerateSamples(userRepo, todoRepo); err != nil {
2020-11-04 20:12:13 +01:00
panic(err)
}
2020-11-04 20:12:13 +01:00
app := iris.New()
app.PartyFunc("/", api.NewRouter(userRepo, todoRepo))
2020-11-04 20:12:13 +01:00
// POST http://localhost:8080/signin (Form: username, password)
// GET http://localhost:8080/todos
// GET http://localhost:8080/todos/{id}
// POST http://localhost:8080/todos (JSON, Form or URL: title, body)
// GET http://localhost:8080/admin/todos
app.Listen(":8080")
}