Skip to content

omfj/go-rest-openapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go REST API with OpenAPI

Start the application, migrations will be run for you.

swag init
go run .

See documentation at:

In a another terminal try these endpoints.

# Health check
curl http://localhost:3000/

# Get all posts
curl http://localhost:3000/posts | jq

# Get posts from a specific users
curl http://localhost:3000/user/1/posts | jq

# Create a post for a user
curl -H "Authorization: Bearer token123" \
        -H "Content-Type: application/json" \
        -d '{"title": "My first post", "content": "This is the body of my first post."}' \
        -X POST http://localhost:3000/posts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages