Skip to content

Showcases a middle tier built with peasy-js and consumed by multiple client consumers

License

Notifications You must be signed in to change notification settings

Ziyadoo/peasy-js-samples

 
 

Repository files navigation

peasy

Showcases a middle tier built with peasy-js.

A full implementation of a middle tier built using the peasy-js framework and consumed by react and nodejs can be found here. You can clone the repo (git clone https://github.com/peasy/peasy-js-samples.git) or download the entire solution as a zip.

The sample application is a ficticious order entry / inventory management system. All efforts were made to keep this application as simple as possible to focus on how a middle tier can be written with peasy-js and consumed by multiple clients (client and server).

Requirements

  1. nodejs - this application is a nodejs application and therefore must be installed.
  2. postman, fiddler, cURL, or similar - 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 install
  2. npm run start

samples

By default, the client (react) application is configured to use http implementations of the data proxies that communicate with the Web API. In turn, the Web API ic 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.

Running the unit tests

peasy-js was designed with unit testing in mind, and as a result, each actor in the application has corresponding unit tests, located in the /spec directory.

To run the tests, navigate to the /spec directory from a command line and run the following command:

jasmine

Like what you see?

Please consider showing your support by starring the project.

About

Showcases a middle tier built with peasy-js and consumed by multiple client consumers

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 98.5%
  • HTML 1.3%
  • CSS 0.2%