Browse Source

fix: count url fix and updated readme for ROOT URL

pull/1/head
oof1lab 7 years ago
parent
commit
47c0742af5
  1. 5
      README.md
  2. 2
      lib/xsql.js

5
README.md

@ -39,6 +39,10 @@ Powered by node packages : (express, mysql) => { xmysql }
Run HTTP client [Postman](https://www.getpostman.com/) or [similar tools](https://chrome.google.com/webstore/search/http%20client?_category=apps) to invoke REST API calls
## ROOT
Root URL (localhost:3000/) returns all REST API urls for each table in schema.
## CRUD APIs Usual Suspects
* GET       /api/:tableName
* POST      /api/:tableName
@ -139,6 +143,7 @@ xmysql identifies foreign key relations automatically and provides GET api.
eg: Customers is parent table and payments is child table. API invocation will result in all payments with customer 103.
## When to use ?
* You need REST APIs without much hassle for (ANY) MySql database
* You are learning new frontend frameworks and need REST APIs for your MySql database.

2
lib/xsql.js

@ -390,7 +390,7 @@ class Xsql {
routes.push(this.prepareRoute('get', apiPrefix, tableName + '/:id'))
routes.push(this.prepareRoute('put', apiPrefix, tableName + '/:id'))
routes.push(this.prepareRoute('delete', apiPrefix, tableName + '/:id'))
routes.push(this.prepareRoute('get', apiPrefix, tableName + '/:id/count'))
routes.push(this.prepareRoute('get', apiPrefix, tableName + '/count'))
routes.push(this.prepareRoute('get', apiPrefix, tableName + '/:id/exists'))
for (var j = 0; j < table['foreignKeys'].length; ++j) {

Loading…
Cancel
Save