There are 3 models in the ORM:
- football club
- players
- doctors
They have the following references:
- 1:N - football club : players
- 1:N - football club : doctors
- N:N - players : doctors
The following HTTP Request Methods are supported:
- POST (create object, add relation)
- GET (read object, read all objects)
- PUT (edit object's field)
- DELETE (delete object, delete relation)
Two content types of requests are supported:
- JSON
- XML
POST host/{entity}
Creates an object of {entity} type with the fields sent in the request body. Request body should contain object's fields.
Request's body example:
{
"name":"Object name"
}
<name>Object name</name>
GET host/{entity}
Returns a list of existing objects of {entity} type.
No request body needed.
GET host/{entity}/{objectId}
Returns info about the object of {entity} type with {objectId} id.
No request body needed.
PUT host/{entity}/{objectId}
Updates all the fields, sent in request body, of an object of {entity} type with {objectId} id.
Request's body example:
{
"name":"New object's name"
}
<name>New object's name</name>
POST host/{firstEntity}/{firstObjectId}/{secondEntity}/{secondObjectId}
Links two objects - of {firstEntity} type with {firstObjectId} and of {secondEntity} type with {secondObjectId}.
No request body needed.
DELETE host/{firstEntity}/{firstObjectId}/{secondEntity}/{secondObjectId}
Deletes relation between two objects - of {firstEntity} type with {firstObjectId} and of {secondEntity} type with {secondObjectId}.
No request body needed.
DELETE host/{entity}/{objectId}
Deletes an object of {entity} type with {objectId} id.
No request body needed.
Entities can be added by defining a model in /orm/orm.js and creating an appropriate function in /models/read.js.