npm install
npm run dev
The REST API to the example app is described below.
Headers {
"Content-Type": "application/json"
}
POST /api/user/login
"email": String,
"password": String
{ "email":"test-mail@gmail.com", "password":"qwerty123" }
"token": String
{ "token": "eyJhbGciOiJ.......dRsfKBU9YxfmWYpXix14qb-0wh2Gi8gAkYMLEM", }
GET /api/user/refresh
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
{}
"token": String
{ "token": "eyJhbGciOiJ.......dRsfKBU9YxfmWYpXix14qb-0wh2Gi8gAkYMLEM", }
POST /api/estate
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
"name": String,
"description": String,
"price": Number,
"address": String,
"area": Number,
"Images": File || File[],
{
"name": "plaza2",
"price": 1200,
"description": "text description",
"address": "Taganrog",
"area": 64.2,
"image": [
Files
]
}
"id": Number,
"name": String,
"price": Number,
"description": String,
"address": String,
"area": Number,
"updatedAt": Timestamp,
"createdAt": Timestamp,
"image": String[]
{ "id": 2, "name": "plaza2", "price": 1200, "description": "text description", "address": "Taganrog", "area": 64.2, "updatedAt": "2024-05-11T17:34:04.912Z", "createdAt": "2024-05-11T17:34:04.912Z", "image": [ "ca36c9ec-3a3e-491d-a8d9-019cbd085e73.jpg", "2a34f582-07f5-42b5-9bbe-91c011744a19.jpg" ] }
GET /static/:imageName
Image
GET /api/estate
[
{
"id": Number,
"name": String,
"price": Number,
"description": String,
"address": String,
"area": Number,
"updatedAt": Timestamp,
"createdAt": Timestamp,
"image": String[]
}
]
[ { "id": 2, "name": "plaza2", "price": 1200, "description": "text description", "address": "Taganrog", "area": 64.2, "updatedAt": "2024-05-11T17:34:04.912Z", "createdAt": "2024-05-11T17:34:04.912Z", "image": [ "ca36c9ec-3a3e-491d-a8d9-019cbd085e73.jpg", "2a34f582-07f5-42b5-9bbe-91c011744a19.jpg" ] } ]
GET /api/estate/:id
"id": Number,
"name": String,
"price": Number,
"description": String,
"address": String,
"area": Number,
"updatedAt": Timestamp,
"createdAt": Timestamp,
"image": String[]
{ "id": 2, "name": "plaza2", "price": 1200, "description": "text description", "address": "Taganrog", "area": 64.2, "updatedAt": "2024-05-11T17:34:04.912Z", "createdAt": "2024-05-11T17:34:04.912Z", "image": [ "ca36c9ec-3a3e-491d-a8d9-019cbd085e73.jpg", "2a34f582-07f5-42b5-9bbe-91c011744a19.jpg" ] }
DELETE /api/estate
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
"estateId": Number
{ "estateId":"1" }
Number ("1" if deleted)
1
POST /api/statement/
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
"name":String,
"email":String,
"text":String,
"phone":String,
"consultation": Boolean,
{ "name":"Inal", "email":"test2@mail.ru", "text":"statement text", "phone":"89281234567", "consultation": true, }
"id": Number,
"name": String,
"phone": String,
"email": String,
"text": String,
"consultation": Boolean,
"updatedAt": Timestamp,
"createdAt": Timestamp
{ "id": 2, "name": "Inal", "phone": "1234567890000", "email": "test2@mail.ru", "text": "statement text", "consultation": false, "updatedAt": "2024-05-11T18:04:57.992Z", "createdAt": "2024-05-11T18:04:57.992Z" }
GET /api/statement/:id
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
"id": Number,
"name": String,
"phone": String,
"email": String,
"text": String,
"consultation": Boolean,
"updatedAt": Timestamp,
"createdAt": Timestamp
{ "id": 2, "name": "Inal", "phone": "1234567890000", "email": "test2@mail.ru", "text": "statement text", "consultation": false, "updatedAt": "2024-05-11T18:04:57.992Z", "createdAt": "2024-05-11T18:04:57.992Z" }
GET /api/statement/
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
[
{
"id": Number,
"name": String,
"phone": String,
"email": String,
"text": String,
"consultation": Boolean,
"updatedAt": Timestamp,
"createdAt": Timestamp
}
]
[ { "id": 2, "name": "Inal", "phone": "1234567890000", "email": "test2@mail.ru", "text": "statement text", "consultation": false, "updatedAt": "2024-05-11T18:04:57.992Z", "createdAt": "2024-05-11T18:04:57.992Z" } ]
DELETE /api/statement/
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
"statementId":String
{ "statementId":"2" }
{
"id": Number,
"name": String,
"phone": String,
"email": String,
"text": String,
"consultation": Boolean,
"updatedAt": Timestamp,
"createdAt": Timestamp
}
{ "id": 2, "name": "Inal", "phone": "1234567890000", "email": "test2@mail.ru", "text": "statement text", "consultation": false, "updatedAt": "2024-05-11T18:04:57.992Z", "createdAt": "2024-05-11T18:04:57.992Z" }
POST /api/owner/
Headers {
"Authorization" : "Bearer 'your token'",
"Content-Type": "application/json"
}
"name":String,
"address":String",
"email":String
{ "name":"Ra_Agency223", "address":"Taganrog", "email":"test@mail.ru" }
"id": Number,
"name": String,
"email": String,
"address": String,
"createdAt": Timestamps,
"updatedAt": Timestamps
{ "id": 1, "name": "RA_Agency", "email": "rasul-adzhimuradov@mail.ru", "address": "Russia", "createdAt": "2024-01-04T21:00:00.000Z", "updatedAt": "2024-05-11T18:19:34.047Z" }
GET /api/owner
[
{
"id": Number,
"name": String,
"email": String,
"address": String,
"createdAt": Timestamps,
"updatedAt": Timestamps
}
]
[ { "id": 1, "name": "RA_Agency", "email": "rasul-adzhimuradov@mail.ru", "address": "Russia", "createdAt": "2024-01-04T21:00:00.000Z", "updatedAt": "2024-05-11T18:19:34.047Z" } ]