Display and manage the user's catalogs in a functional table.
- Server: TypeScript, node.js, express, and MongoDB
- Client: TypeScript, React.js, and react-bootstrap
- Display catalogs in a table.
- Adding a new catalog.
- Update an existing catalog.
- Delete catalogs from the table.
- Set an indexing process for a catalog.
- Clone the repository
- Install dependencies:
- Client:
cd client npm install
- Server:
cd server npm install
- Configure environment variables:
- create a .env file in the server directory and add the following:
PORT:5000 MONGO_URI=mongodb://localhost:27017/your-database-name
- Start the development servers:
- client:
cd client npm start
- server:
cd server npm run dev
- Endpoint: GET /api/catalog
- Description: Return all the catalog records.
- Response:
[ { "_id": "674359998f46118e44245c84", "name": "TestCatalog", "vertical": "home", "primary": true, "locales": [ "en_CA", "en_IL", "en_GB" ], "indexedAt": null, "createdAt": "2024-11-24T16:51:37.801Z", "updatedAt": "2024-11-24T16:51:37.801Z", } ]
- Endpoint: POST /api/catalog
- Description: Return all the catalog records. If 'primary' -> set the rest of the catalogs on the same vertical as not primary.
- Request:
{"name":"TestCatalog","primary":true,"vertical":"home","locales":["en_CA","en_IL","en_GB"]}
- Response:
*updated indicates if other resources were updated based on 'primary'
{ "catalog": { "name": "TestCatalog", "vertical": "home", "primary": true, "locales": [ "en_CA", "en_IL", "en_GB" ], "indexedAt": null, "_id": "674359998f46118e44245c84", "createdAt": "2024-11-24T16:51:37.801Z", "updatedAt": "2024-11-24T16:51:37.801Z", }, "updated": true }
- Endpoint: PUT /api/catalog/:id
- Description: Update the catalog with the given properties.
If 'primary' -> set the rest of the catalogs on the same vertical as not primary.
{ "_id":"674359998f46118e44245c84", "name":"TestCatalog", "primary":true, "vertical":"home", "indexedAt":"", "locales":["af_NA","af_ZA"], "createdAt":"2024-11-24T16:51:37.801Z" }
- Response:
*updated indicates if other resources were updated based on 'primary'
{ "catalog": { "name": "TestCatalog", "vertical": "home", "primary": true, "locales": [ "en_CA", "en_IL", "en_GB" ], "indexedAt": null, "_id": "674359998f46118e44245c84", "createdAt": "2024-11-24T16:51:37.801Z", }, "updated": true }
- Endpoint: DELETE /api/catalog
- Description: Delete the given record ids.
- Request:
{"ids":["674326993e6e698b4ac1b4ad"]}
- Response:
{"updated":true}
- Endpoint: PUT /api/catalog/index/:id
- Description: Sets the time of the last index process.
- Response:
{ "_id": "674359998f46118e44245c84", "name": "TestCatalog", "vertical": "home", "primary": true, "locales": [ "af_NA", "af_ZA" ], "indexedAt": "2024-11-24T17:19:13.446Z", "createdAt": "2024-11-24T16:51:37.801Z", }