-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
58153e2
commit c3a6760
Showing
12 changed files
with
20 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1 @@ | ||
## Root | ||
|
||
### 1. Transaction | ||
|
||
To start a transaction call `/transaction` endpoint with `POST` method. | ||
|
||
```bash | ||
curl --request POST \ | ||
--url http://localhost:8000/api/transaction \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"transaction": [ | ||
{ | ||
"statement": "INSERT INTO Artist (ArtistId, Name) VALUES (:id, :name)", | ||
"values": { "id": 100000, "name": "Glen Hansard" } | ||
}, | ||
{ | ||
"query": "SELECT * FROM Artist ORDER BY ArtistId DESC LIMIT 1" | ||
} | ||
] | ||
}' | ||
``` | ||
|
||
Response | ||
|
||
```json | ||
{ | ||
"data": [ | ||
{ | ||
"changes": 1, | ||
"lastInsertRowid": 100000 | ||
}, | ||
[ | ||
{ | ||
"ArtistId": 100000, | ||
"Name": "Glen Hansard" | ||
} | ||
] | ||
] | ||
} | ||
``` |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,9 @@ | ||
const express = require('express'); | ||
|
||
const controllers = require('../controllers/index'); | ||
const { validator } = require('../middlewares/validation'); | ||
const schema = require('../schemas/index'); | ||
|
||
const router = express.Router(); | ||
|
||
router.get('/', controllers.root); | ||
router.post( | ||
'/transaction', | ||
validator(schema.transaction), | ||
controllers.transaction | ||
); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters