Skip to content

Showcases business logic built with peasy-js and consumed by multiple clients

License

Notifications You must be signed in to change notification settings

peasy/peasy-js-samples

Repository files navigation

peasy

Showcases business logic built with peasy-js.

This sample application is a ficticious order entry / inventory management system. All efforts were made to keep this application as simple as possible, with a focus on how business logic can be written with peasy-js and consumed by multiple clients (react, angular, and nodejs).

Where can I get it?

Requirements

  1. nodejs - this application hosts a web api that the client applications rely on and requires node.
  2. postman, fiddler, cURL, or similar (optional) - these tools help to facilitate communications with http endpoints.
  3. MongoDB (optional) - this application by default is configured to work with in-memory data proxies, however, you can easily swap data proxies to interact with a mongodb instance if desired. See MongoDB Configuration for more details.

Running the application

From a command line, navigate to the peasy-js-samples directory and run:

  1. npm run install_dependencies_and_build_projects
  2. npm run server

samples

By default, the client (react and angular) applications are configured to use http implementations of the data proxies. These data proxies communicate with the http endpoints hosted in node.

In turn, the http endpoints are configured to use in-memory data proxies. However, there are a few configuration possibilities. The configurations section provides details on setting up many potential configurations.

Configurations

Client → In-Memory

In this scenario, the client consumes business services that are injected with data proxies that communicate with in-memory data stores.

archlessnode

Client → Web API → In-Memory (Default configuration)

In this scenario, the client consumes business services that are injected with data proxies that use HTTP to communicate with the Web API application. In turn, the Web API application uses business services that are injected with data proxies that communicate with in-memory data stores.

archlessmongo

Client → Web API → MongoDB

In this scenario, the client consumes business services that are injected with data proxies that use HTTP to communicate with the Web API application. In turn, the Web API application uses business services that are injected with data proxies that communicate with a MongoDB database.

architecture

Testing out the Web API

With the application up and running you can navigate to the following urls:

Web API Walkthrough

This walkthrough covers creating a customer, category, product, and placing an order on behalf of the new customer. It also covers submitting and shipping an order to see how it affects inventory.

Like what you see?

Please consider showing your support by starring the project.