Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ The Example app has the same source code as the standard API Hub. [The Example a
- [Auto-detect the API Hub URL](./packages/example/README.md##auto-detect-the-api-hub-url)
- [Customization Tutorials](./packages/example/README.md##customization-tutorials)

### Healthcare App
### Healthcare App [Deprecated]

> **_Note:_** The Healthcare app is now deprecated. It will no longer be actively maintained and will not receive new features or updates, including bug fixes. This deprecation is part of our ongoing efforts to improve the repository and streamline functionality.

[The Healthcare app](./packages/healthcare/README.md) demonstrates a possible customized variation of API Hub with a Healthcare theme. It includes the same developer features as the Example app. It further extends the API Hub to include custom pages and additional calls (PAPI and Portal Metrics API). You use this app with the mock server.

Expand All @@ -33,7 +35,9 @@ The Healthcare app README includes the following information:
- [Available users](./packages/healthcare/README.md##available-users)
- [Customize the Healthcare app](./packages/layer7-apihub-mock/README.md##customize-the-healthcare-app)

### Layer7 API Hub Mock Server
### Layer7 API Hub Mock Server [Deprecated]

> **_Note:_** Layer7 API Hub Mock Server is now deprecated. It will no longer be actively maintained and will not receive new features or updates, including bug fixes. This deprecation is part of our ongoing efforts to improve the repository and streamline functionality.

[The Layer7 API Hub mock server README](./packages/layer7-apihub-mock/README.md) includes the following information:

Expand All @@ -54,6 +58,7 @@ Use the following commands to set up you local development environment.
**Prerequisites:**

Before setting up your local development environment, ensure that you have completed the following:

- You have installed [Yarn](https://yarnpkg.com/).
- You have installed GNU Make 3.81 or later.
- You have installed Node v12.20.2.
Expand All @@ -65,6 +70,7 @@ Install the JavaScript dependencies by issuing the following command:
```sh
make install
```

### Start an App

Start the Example app or the Healthcare app in watch mode.
Expand All @@ -85,29 +91,29 @@ make start-healthcare

Run the unit tests and the E2E tests by issuing the following command:

```
```
make test
```

#### Unit Tests

Run only the unit tests by issuing the following command:

``` sh
```sh
make test-unit
```

#### End-To-End Tests

Run only the E2E tests:

``` sh
```sh
make test-e2e
```

Open the E2E tests GUI (useful for writing and debugging E2E tests):

``` sh
```sh
make test-e2e-local
```

Expand Down Expand Up @@ -136,6 +142,7 @@ Follow these steps:
```sh
$ cd packages && yarn create react-app my-own-apihub --scripts-version=3.2.0
```

2. Add the `layer7-aphub`, `layer7-apihub-mock`, and `react-admin` packages as dependencies in the new package.json:

```
Expand All @@ -147,15 +154,17 @@ $ cd packages && yarn create react-app my-own-apihub --scripts-version=3.2.0
"react-admin": "~3.6.2",
"react-scripts": "~3.2.0"
},
```
```

3. Copy the config files to the `example` package by issuing the following commands:

```sh
$ cp -r packages/example/config packages/my-own-apihub/config/
$ cp packages/my-own-apihub/config/config-dev.js packages/my-own-apihub/public/config.js
```

4. Update the public `index.html` file to include the `config.js` file:

```html
<!-- in packages/my-own-apihub/public/index.html -->
<head>
Expand All @@ -166,6 +175,7 @@ $ cp packages/my-own-apihub/config/config-dev.js packages/my-own-apihub/public/c
```

5. Include the base API Hub component in the `App.js` file:

```js
// in packages/my-own-apihub/src/App.js
import { ApiHubAdmin } from 'layer7-apihub';
Expand All @@ -182,6 +192,7 @@ const App = () => {
```

6. Add the mock server to the `index.js` file

```js
// in packages/my-own-apihub/src/index.js
import { startApiHubMockedServer } from 'layer7-apihub-mock';
Expand All @@ -200,6 +211,7 @@ if (!shouldEnableMock(ENABLE_MOCK)) {
```

7. Start the bare-bones my-own-apihub app by issuing the following commands:

```
$ cd packages/my-own-apihub
$ yarn install
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@
"es-abstract": "~1.19.0",
"elliptic": "~6.5.7",
"get-intrinsic": "~1.1.3",
"serialize-javascript": "~3.1.0",
"serialize-javascript": "~6.0.2",
"qs": "6.9.7",
"rehype-ignore": "1.0.1",
"ua-parser-js": "0.7.35",
"url-parse": "^1.5.9",
"fast-json-patch": "3.1.1",
"yaml": "2.0.0-1"
}
}
}
2 changes: 1 addition & 1 deletion packages/example/src/TestPage.js
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function TestPage() {
<h2>ApiEula</h2>
<p
dangerouslySetInnerHTML={{
__html: apiEula ? apiEula.Content : null,
__html: apiEula ? apiEula.content : null,
}}
/>
</>
Expand Down
2 changes: 1 addition & 1 deletion packages/example/src/ui/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export const Footer = () => {
variant="body2"
className={classes.copyright}
>
Copyright © 2024 Broadcom. All Rights Reserved
Copyright © 2025 Broadcom. All Rights Reserved
</Typography>
)}
</div>
Expand Down
13 changes: 8 additions & 5 deletions packages/healthcare/README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Healthcare App
# Healthcare App [Deprecated]

> **_Note:_** The Healthcare app is now deprecated. It will no longer be actively maintained and will not receive new features or updates, including bug fixes. This deprecation is part of our ongoing efforts to improve the repository and streamline functionality.

The Healthcare app demonstrates a customization of [the Layer7 API Hub Library](../layer7-apihub/README.md). This app uses [the Layer7 API Hub mock server](../layer7-apihub-mock) as the backend server.

Expand All @@ -9,28 +11,29 @@ The Healthcare app is built on top of [Create React App (CRA)](https://create-re
The following user roles are available in this app:

- Portal Admin

- login: `portalAdmin`
- password: `Password@1`

- API Owner

- login: `apiOwner`
- password: `Password@1`

- Org Publisher
- login: `orgPublisher`
- password: `Password@1`

- Org Admin

- login: `Publisher`
- password: `Password@1`

- Developer

- login: `user`
- password: `Password@1`

## Customize the Healthcare App

The Healthcare App leverages the customization mechanisms provided by its underlying libraries:

- [MaterialUI](https://material-ui.com/customization/theming/)
- [react-admin](https://marmelab.com/react-admin/Theming.html)
- [Layer7 API Hub](../layer7-apihub/README.md)
Expand Down
44 changes: 24 additions & 20 deletions packages/layer7-apihub-mock/README.md
100755 → 100644
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Layer7 API Hub Mock Server Package
# Layer7 API Hub Mock Server Package [Deprecated]

> **_Note:_** Layer7 API Hub Mock Server is now deprecated. It will no longer be actively maintained and will not receive new features or updates, including bug fixes. This deprecation is part of our ongoing efforts to improve the repository and streamline functionality.

This package provides an API Hub mock server that intercepts calls to the Portal API (PAPI) and sends back a generated response. This mock server runs in a web browser.

Expand Down Expand Up @@ -34,7 +36,7 @@ startApiHubMockedServer().then(() =>

The mock server creates a global `Layer7Mock` object. You can access the local database using this object in your browser's Developer Tool console:

``` js
```js
Layer7Mock.database // Returns the data base
Layer7Mock.resetDatabase() // Delete then recreate the local database
Layer7Mock.clearDatabase() // Delete the local database
Expand Down Expand Up @@ -67,30 +69,32 @@ startApiHubMockedServer({ showRunningIndicator: false }).then(() =>
The following user roles are included with the mock server:

- Portal Admin
- login: `portalAdmin`
- password: `Password@1`

- login: `portalAdmin`
- password: `Password@1`
- API Owner
- login: `apiOwner`
- password: `Password@1`

- Org Publisher
- login: `orgPublisher`
- password: `Password@1`

- Org Admin
- login: `Publisher`
- password: `Password@1`

- Developer
- login: `user`
- password: `Password@1`

- login: `apiOwner`
- password: `Password@1`
- Org Publisher

- login: `orgPublisher`
- password: `Password@1`
- Org Admin

- login: `Publisher`
- password: `Password@1`
- Developer

- login: `user`
- password: `Password@1`

You can change these user roles by [providing your own Data](#provide-your-own-data).

## Customize the Mock Server

You can customize the mock server by adding API routes and entities. The `startApiHubMockedServer()` function returns an object that includes the following keys:

- `server`. This key is the MirageJS server instance. You can add API routes using this server instance.
- `database`. This key is a [minimongo](https://github.com/mWater/minimongo) instance. You can add entities using this instance. These entities are persisted in an IndexedDb database.

Expand Down Expand Up @@ -170,7 +174,7 @@ For more information about these PAPI objects, see [the Layer7 API Developer Por

To generate new data, run the following command which accepts an output file:

``` sh
```sh
./bin/generateData.js myOutputFile.json
```

Expand Down
Loading