Skip to content

Latest commit

 

History

History

sqlx

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Macaron + sqlx

This is an example of using Macaron and sqlx to achieve CRUD tasks for songs.

Install and run:

$ go get github.com/go-macaron/examples/sqlx
$ cd github.com/go-macaron/examples/sqlx
$ make
  • Create a song:

     curl --data "title=Shake It Off&artist=Taylor Swift&year=2014" http://localhost:4000/songs
  • Get all songs:

     curl http://localhost:4000/songs
  • Get a song:

     curl http://localhost:4000/songs/1
  • Edit a song:

     curl --request PATCH --data "title=Shake It Off2&artist=Taylor Swift&year=2014" http://localhost:4000/songs/1
  • Delete a song:

     curl --request DELETE http://localhost:4000/songs/1