Skip to content

📓 A demo project to show how to develop a Platform 6 service with C# using the C# connector.

License

Notifications You must be signed in to change notification settings

amalto/platform6-service-csharp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Platform 6 C# Service Demo

A demo service to show how to develop a Platform 6 service with C# using Platform 6 C# connector.

Prerequisite

What is this demo about?

This project shows how to:

  • create a simple Nancy application server,
  • initialize a custom service on Platform 6,
  • implement the endpoint that displays the service's user interface

General notes about the user interface of the service

The configuration interface

Every service should have a configuration interface. It is the main screen displayed when a user clicks on the associated entry menu in the Platform 6 Portal. Here's the configuration interface of our demo service:

Service's configuration interface

This interface is defined in the file ServiceConfiguration.tsx which has been developed using the framework React.

For now React is the only supported library on Platform 6.

The user interface must export a single main React component through a bundled JavaScript file (see Webpack for bundling and Babel for transpiling). This script will be injected and displayed on the Portal.

Platform 6 UI components

To help you build the user interface of your custom service, a set of components is ready for use on Platform 6. They can be included as a JavaScript dependency from the library platform6-ui-components.

The documentation of these components is available online.

How to run the demo?

Build the user interface

Go in the client's directory and install its dependencies:

$ cd Platform6/Client
$ npm install

Compile the TypeScript source files to generate the compiled bundle file Platform6/Client/build/ServiceConfiguration.bundle.js:

$ npm run build

You can also use the watch mode to generate a new bundle file after every change made to the source files. The command is then: npm run build:watch.

Run the server of the service

The server in the demo is built using the framework Nancy. To launch it, from the root directory:

Install the dependencies:

$ cd Platform6
$ mkdir packages && cd packages
$ nuget install ../packages.config

Build the server:

Compile the C# classes to create the .exe in the folder bin/Debug/.

$ msbuild Platform6/Service.csproj 

Run the server:

From the directory bin/Debug/, export some environment variables:

$ export B2BOX_HOST=localhost && export EXTERNAL_URL=http://localhost:8888

Use Mono to run the project:

$ mono ./Service.exe

It should launch a server on the port 8888 then deploy the service demo.csharp on Platform 6.

An entry menu Csharp should appear in the menu of the Portal.

When you click on it, it should make a request to the endpoint GET /api/${VERSION}/demo.csharp/portal. This endpoint returns the client's bundled JavaScript file ServiceConfiguration.bundle.js that you built at the previous step.

Here is an example of the output:

/******/ (function(modules) { // webpackBootstrap↵/******/     // The module cache↵/******/     var installedModules = {};↵/******/↵/******/     // The require function↵/******/     function __webpack_require__(moduleId) [...]

The Portal will use this response to display the user interface of the service.

License

MIT © Platform 6

About

📓 A demo project to show how to develop a Platform 6 service with C# using the C# connector.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •