resources/clients/react/item-tracker/README.md
Shows how to use React to create a web page that connects to a REST service that lets you do the following:
The web client is designed to send requests to one of the following sample applications. Each sample application shows you how to use an AWS SDK to store work items using AWS resources:
To build and run the web client, you must have Node.js installed on your computer. The web client was built and tested by using Node.js 16.14.2.
Install all of the packages needed to run the web client by running the following at
a command prompt in the resources/clients/react/item-tracker folder:
npm install
Each sample application hosts a REST endpoint. After you set up and run one of the sample REST applications, configure the web client to send requests to the endpoint by updating src/config.json.
BASE_URL value with the endpoint provided by your sample
application.Run the web client in development mode by running the following at a command prompt in
the resources/clients/react/item-tracker folder:
npm start
This opens http://localhost:3000 in your browser. When the web client starts, it sends a GET request to the configured REST endpoint to retrieve any existing active work items and displays them in a table.
The web client sends the following REST requests to the REST endpoint:
Retrieves a list of work items. The default route returns all active items. Optional states are archive
for archived items and all for all items regardless of state.
*
Items are expected to be a JSON array of items that each have the following fields:
[{
"id": "<item ID>",
"name": "<user name>",
"guide": "<guide name>",
"description": "<item description>",
"status": "<item status>"
}, {
...more items...
}]
Adds a work item to the list.
The body of the request is a single item in JSON format.
{
"name": "<user name>",
"guide": "<guide name>",
"description": "<item description>",
"status": "<item status>"
}
Archives an active work item.
itemId is the ID of the item to archive.Sends an email report of work items.
The body of the request has the target email and the currently shown state in JSON format.
{
"email": "<recipient's email address>",
"status": "<blank>|all|archive"
}
The web client unit tests do not require a REST endpoint and do not create or use any
AWS resources. Run all of the tests by running the following at a command prompt in
the resources/clients/react/item-tracker folder:
npm test
This launches the test runner in interactive watch mode.
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0