Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/matoka02/product-catalog-be
Server for sending data about products.
https://github.com/matoka02/product-catalog-be
cors express-js mongodb mongoose node-js typescript
Last synced: about 1 month ago
JSON representation
Server for sending data about products.
- Host: GitHub
- URL: https://github.com/matoka02/product-catalog-be
- Owner: matoka02
- License: mit
- Created: 2024-06-21T18:15:48.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-07-28T12:15:42.000Z (6 months ago)
- Last Synced: 2024-07-28T14:29:01.315Z (6 months ago)
- Topics: cors, express-js, mongodb, mongoose, node-js, typescript
- Language: TypeScript
- Homepage: https://ghostmatoka.onrender.com
- Size: 88.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Usage
## Endpoints
Request
- **GET /products**
Query
- **`page`** _(optional)_: Page number for products. Defaults to 1.
- **`perPage`** _(optional)_: Number of products per page. Defaults to 4.
- **`sortBy`** _(optional)_: Sort by date of updating the product. Defaults to Newest. Possible variants is: `Newest`, `Oldest`Example:
```http
GET /products?page=2&perPage=10&sortBy=Newest
```Response
The `/products` endpoint returns a list of products in JSON format. Example response:
```json
{
"totalProducts": 71,
"data": [
{
"id": "string",
"priceDiscount": 1000,
"name": "string"
// ...
}
// Other products...
]
}
```Request
- **GET /products/:id**
Params
- **`:id`**: Product id
Example:
```http
GET /products/productId
```Response
The `/products/:id` endpoint returns a list of products in JSON format. Example response:
```json
{
"id": "string",
"priceDiscount": 1000,
"name": "string"
// ...
}
```