Install Denon:
deno install -qAf --unstable https://deno.land/x/denon@2.4.4/denon.ts
and run the development server:
denon dev
Create a .env
file and add the follow environment variables:
PORT=[YOUR PORT NUMBER]
PG_HOST=[POSTGRES HOST]
PG_USER=[POSTGRES USERNAME]
PG_PASSWORD=[POSTGRES PASSWORD]
PG_DATABASE=[POSTGRES DATABASE]
follow the .env.example
model.
and run the production server:
deno run --allow-read --allow-write --allow-net src/app.ts
to use SSL see Use HTTPS topic
to run the production server with Docker, install Docker and docker-compose, and run:
docker-compose up
To use HTTPS you need to create a folder src/ssl
, and add your certificate and key inside src/ssl
, with the names cert.pem
and key.pem
.
Then, you need to start de server with the flag --secure
:
deno run --allow-read --allow-write --allow-net src/app.ts --secure
route: POST /clothes
request body:
JSON:
product: Description of the product - string
brand: Product brand - string
quantity: Quantity of product purchased - number
provider: Product Provider - string
price: Price of the product - float
currentInventory: Current stock available - number
size: Size of the product - string
inputValues: Profit obtained - float
outputValues: Product spending - float
e.g.:
{
"product": "CROPPED COURINO PRETO",
"brand": "ANTONY",
"quantity": 2,
"provider": "Luana",
"price": 20.00,
"currentInventory": 2,
"size": "G,M",
"inputValues": 20.00,
"outputValues": 20.00
}
expected response status code: 201
route: GET /clothes
request body: NO BODY
expected response status code: 200
expected response body:
ARRAY OF JSON:
product: Description of the product - string
brand: Product brand - string
quantity: Quantity of product purchased - number
provider: Product Provider - string
price: Price of the product - float
currentInventory: Current stock available - number
size: Size of the product - string
inputValues: Profit obtained - float
outputValues: Product spending - float
route: GET /clothes/:id
request body: NO BODY
expected response status code: 200
expected response body:
JSON:
product: Description of the product - string
brand: Product brand - string
quantity: Quantity of product purchased - number
provider: Product Provider - string
price: Price of the product - float
currentInventory: Current stock available - number
size: Size of the product - string
inputValues: Profit obtained - float
outputValues: Product spending - float
route: DELETE /clothes/:id
request body: NO BODY
expected response status code: 200
route: PUT /clothes/:id
request body:
JSON:
product: Description of the product - string
brand: Product brand - string
quantity: Quantity of product purchased - number
provider: Product Provider - string
price: Price of the product - float
currentInventory: Current stock available - number
size: Size of the product - string
inputValues: Profit obtained - float
outputValues: Product spending - float
e.g.:
{
"product": "CROPPED COURINO PRETO",
"brand": "ANTONY",
"quantity": 2,
"provider": "Luana",
"price": 20.00,
"currentInventory": 2,
"size": "G,M",
"inputValues": 20.00,
"outputValues": 20.00
}
expected response status code: 200