typescript-ecommerce-example
eCommerce
TypeScript
TypeScript E-commerce Example
A simple e-commerce REST API built with TypeScript to learn and practice design patterns.
Stack
Installation
-
$ git clone https://github.com/GuilhermeMLS/typescript-ecommerce-example.git
-
$ cd typescript-ecommerce-example/
-
$ npm install
-
$ npm start
Docs
-
Simulate a checkout action
-
Endpoint: GET
/:cartId
-
Response:
{ "cartId": "123ABC", "value": 4500, "items": [ { "name": "Couch", "value": 3200, "id": 1 }, { "name": "Bed", "value": 700, "id": 2 }, { "name": "Desk", "value": 600, "id": 3 } ], "paymentMethods": [ { "name": "Credit Card", "tax": 0.05, "valueToPay": 4725 }, { "name": "Boleto", "tax": 0, "valueToPay": 4500 }, { "name": "Financing", "tax": 0.12, "valueToPay": 5040 } ], "shippingAddress": { "street": "R. Marechal Deodoro", "number": 1001 } }
-
Endpoint: GET
-
Simulate a payment action
-
Endpoint: POST
/
-
Body:
{ "cartId": "123ABC", "paymentMethod": { "id": 1 } }
<li> Response: <pre>{ "items": [ { "name": "Couch", "value": 3200, "id": 1 }, { "name": "Bed", "value": 700, "id": 2 }, { "name": "Desk", "value": 600, "id": 3 } ], "value": 4725, "shippingAddress": { "street": "R. Marechal Deodoro", "number": 1001 }, "paymentMethod": { "id": 1, "name": "Credit Card", "tax": 0.05 }, "createdAt": 1593219325744
}
-
Endpoint: POST