Skip to content

MystixCode/api-example

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-example

Dependencies

  • go
  • a mysql/mariadb database
go mod init

Edit config.json

{
  "server": {
    "host": "0.0.0.0",
    "port": "8080"
  },
  "database": {
    "driver": "mysql",
    "username": "dbuser",
    "password": "password",
    "host": "127.0.0.1",
    "port": "3306",
    "name": "dbname"
  },
  "logger": {
    "debug": true,
    "logfile_path": "./log/",
    "logfile_name": "api-example.log"
  }
}

Setup Database

go run main.go migrate

Run it

go run main.go serve

Create test items

curl -X POST localhost:8080/tests -H 'Content-Type: application/json' -d '{"Name":"testname","Description":"testdescription"}'

Help

go run main.go -h

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages