Skip to content

Commit

Permalink
Move petdesk sample application to samples-is
Browse files Browse the repository at this point in the history
  • Loading branch information
ShanChathusanda93 committed Mar 31, 2024
1 parent abfaaed commit 56b0594
Show file tree
Hide file tree
Showing 75 changed files with 21,422 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,7 @@ target
*.iml

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
hs_err_pid*

# Dependency directories
node_modules/
41 changes: 41 additions & 0 deletions petcare-sample/b2c/web-app/petdesk/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# B2C PetDesk Sample Application Setup Guide

## Prerequisites:
1. Install Ballerina 2201.5.0 https://dist.ballerina.io/downloads/2201.5.0/ballerina-2201.5.0-swan-lake-macos-arm-x64.pkg
2. Install Node 16 LTS (Tested in v16.13.0).
3. Clone https://github.com/wso2/samples-is and the sample will be in the petcare-sample/b2c directory.

## Deploy API Services
1. Navigate to <PROJECT_HOME>/petcare-sample/b2c/web-app/petdesk/apis/ballerina/pet-management-service and start the
pet management service by executing the following command in the terminal.
```
bal run
```
!!! Note
By default, the services store the data in memory.
## Create an Application in WSO2 Identity Server
1. Create a Single-Page Application named `Pet Desk App` in root organization.
2. Add the `Authorized redirect URLs` as `http://localhost:5173`.
3. Go to the `Protocol` tab and copy the `Client ID`.
## Deploy the Front End Application
1. Navigate to <PROJECT_HOME>/petcare-sample/b2c/web-app/petdesk/web/react and update the configuration file
`config.js` with the registered app details.
```
baseUrl: "https://localhost:9443",
clientID: "<CONFIGURED_SPA_CLIENT_ID>",
signInRedirectURL: "http://localhost:5173",
signOutRedirectURL: "http://localhost:5173",
resourceServerURL: "http://localhost:9090",
scope: ["openid", "email", "profile"]
```
2. Run the application by executing the following command in the terminal.
```
npm install
npm run dev
```
3. Visit the sample application at http://localhost:5173.
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# +required Version of the endpoint configuration YAML
version: 0.1

# +required List of endpoints to create
endpoints:
# +required Unique name for the endpoint. (This name will be used when generating the managed API)
- name: Pet Management Service
# +required Numeric port value that gets exposed via this endpoint
port: 9090
# +required Type of the traffic this endpoint is accepting. Example: REST, GraphQL, etc.
# Allowed values: REST, GraphQL, GRPC
type: REST
# +optional Network level visibility of this endpoint. Defaults to Project
# Accepted values: Project|Organization|Public.
networkVisibility: Public
# +optional Context (base path) of the API that is exposed via this endpoint.
# This is mandatory if the endpoint type is set to REST or GraphQL.
context: /
# +optional Path to the schema definition file. Defaults to wild card route if not provided
# This is only applicable to REST endpoint types.
# The path should be relative to the docker context.
schemaFilePath: service_openapi.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"image": "ballerina/ballerina-devcontainer:2201.4.0",
"extensions": ["WSO2.ballerina"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
org = "WSO2"
name = "pet_management_service"
version = "1.0.0"
export = ["pet_management_service"]
distribution = "2201.3.1"

[build-options]
observabilityIncluded = true
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[[container.copy.files]]
sourceFile="./resources/email_template.html"
target="/home/ballerina/resources/email_template.html"
Loading

0 comments on commit 56b0594

Please sign in to comment.