API used to interact with alternative apocalyptic world 😬
npm install
npm start
to start the app
npm test
to run the tests
docker-compose up -d
to run the docker container
docker-compose down
to stop the container
The API runs on port 3000 by default
Used to get the list of all zombies from database
---
[
{
name: "Zombie1",
_id: "123",
createdAt: "2000-10-31T01:30:00.000-05:00",
items: [
name: "item1",
id: 1,
price: 30
]
},
{
name: "Zombie2",
_id: "456",
createdAt: "2002-10-31T01:30:00.000-05:00",
items: [
name: "item2",
id: 3,
price: 50
]
}
]
Used to add new zombies to the database (list of zombies accepted).
body: {
zombies: [{
name: "Zombie1",
createdAt: "2002-10-31T01:30:00.000-05:00", //optional
items: [ //optional
name: "item1",
id: 1,
price: 20
}]
]
}
or
body: {
zombies: ["Zombie1", "Zombie2", "Zombie3"]
}
{
payload: [{
name: "Zombie1",
createdAt: "2002-10-31T01:30:00.000-05:00",
items: [ //if specified
name: "item1",
id: 1,
price: 20
]
}]
}
Used to delete many zombies at once
body: {
zombies: [{
name: "Zombie1",
createdAt: "2002-10-31T01:30:00.000-05:00",
items: [
name: "item1",
id: 1,
price: 20
]
}]
}
or
body: {
zombies: ["123", "456", "789"] //Specify only zombie IDs
}
{
success: [ //all successfully deleted zombies
{
name: "Zombie1",
_id: "123"
createdAt: "2002-10-31T01:30:00.000-05:00",
items:[]
}
],
error: [] //zombies which weren't deleted
}
Used to get details about certain zombie, selected by its ID. Returns creation date and zombie's name.
params: {
zombieId: "123"
}
{
name: "Zombie1",
createdAt: "2002-10-31T01:30:00.000-05:00",
}
Used to add item to zombie. Uses external items database to get the available items. List of allowed items available here: https://zombie-items-api.herokuapp.com/api/items
params: {
zombieId: "123"
}
[
{
name: "item1",
price: 200,
id: 1
},
{
name: "item2",
price: 300,
id: 3
}
]
Used to get the calculated value of zombie's items. The result is calculated in three currencies: EUR, USD, PLN.
params: {
zombieId: "123"
}
{
EUR: 2.21
PLN: 10
USD: 2.5
}
Used to add new item to the zombie's equipment. Zombie can hold maximum of 5 items at once
params: {
zombieId: "123",
}
body: {
itemsId: [1,2]
}
{
name: "Zombie1",
createdAt: "2002-10-31T01:30:00.000-05:00",
items: [{
name: "item1", //newly added item
id: 1,
price: 20
},{
name: "item2", //newly added item
id: 2,
price: 30
}
]
}
Used to delete item from zombie's equipment.
params: {
zombieId: "123",
}
body: {
itemsId: [2]
}
{
name: "Zombie1",
createdAt: "2002-10-31T01:30:00.000-05:00",
items: [{
name: "item2", // item1 was deleted!
id: 1,
price: 20
}]
}