Automatic api generation from an SQL database, complete with http API endpoint scaffolding code and preconditions checking.
- go >= 1.3 (see http://golang.org/)
- a mysql database
- go package gorrilla/mux; (Dependency to be removed by #12)
go get github.com/gorilla/mux
# Get package
go get is-a-dev.com/autoapi
# See that it works (if your go env is setup properly)
autoapi --help
cd $GOPATH/src
mkdir autoapiapp && cd autoapiapp
autoapi -d="DB_NAME" -u="root" -h="localhost" -P="3306"
Once this step is complete your directory should now look like:
$GOPATH/src/whatever/
bin/
main.go (Main application binary, run this to start it)
db/
/mysql
/DB_TABLES (Database queries themselves for mysql)
dbi/
/DB_TABLES
http/
/DB_TABLES
From your project root:
go run bin/main.go -d="DB_NAME" -u="root" -h="localhost" -P="3306"
Your api will now be runnning on: http://localhost:8080 (by default)
- How to change the port and host
- Other amazing features
- It is a good idea to use the routes generated as the base for your project, and include them in new packages instead of modifying them directly.
- Finish constriant issues
- Complete Swagger
- Complete JSON-LD
- Onwards to glory