Skip to content

7bridges-eu/remys

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

87 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

7bridges remys

remys

Interact with MySQL databases using REST APIs.

Usage

$ lein run -- -u <username> -p <password> -d <database> start

The server will be listening on port 3000.

You can specify the hostname and the port of the MySQL database you wish to interact with:

$ lein run -- -H <hostname> -P <port> -u <username> -p <password> -d <database> start

Now you can interact with your database via REST. Examples:

  • get all the records from departments table:
$ curl -i -X GET 'http://localhost:3000/api/departments'
  • get a specific record from departments table:
$ curl -i -X GET 'http://localhost:3000/api/departments/d009'
  • get only some columns from departments table:
$ curl -i -X GET 'http://localhost:3000/api/departments?fields=dept-no,dept-name'
  • run a custom query:
$ curl -i -X POST 'http://localhost:3000/api/dynamic'\
    -H "Content-Type: application/json"\
    -d '{"query":"select * from salaries limit 100"}'
  • update a record:
$ curl -i -X PUT 'http://localhost:3000/api/employees/10001'\
  -H "Content-Type: application/json" -d '{"gender": "F"}'

For further details check the APIs documentation.

remys has been tested using the freely available test_db.

License

Copyright © 2017 7bridges s.r.l.

Distributed under the Apache License 2.0.