Skip to content

Latest commit

 

History

History

Butterfly.Example.Echo

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

Echo Example

A simple echo web client and server using Butterfly.Clients, Butterfly.Web, and Butterfly.Db

This example shows...

  • A plain HTML/JS client subscribing to the Subscription API via the Butterfly.Clients web client to receive updates on the "messages" channel and echoing any updates in an alert() box
  • A plain HTML/JS web client invoking a Web API method to insert a "Hello World" message
  • Implementing the Web API from Butterfly.Web on the server
  • Implementing the Subscription API from Butterfly.Web on the server
  • Using Butterfly.Db on the server to perform database operations and publish the data change events to subscribers

This example uses a plain HTML/JS client but the Butterfly.Clients web client is vanilla javascript and can be used with any framework.

This example uses the EmbedIO web server but Butterfly.Web supports multiple web servers.

This example uses a memory database but Butterfly.Db supports multiple database engines.

Get the Code

git clone https://github.com/firesharkstudios/butterfly-server

Running

Open a terminal or command prompt and run...

cd butterfly-server\Butterfly.Example.Echo\www
npm install
cd ..
dotnet run www

Open a browser to http://localhost:8000/ and you should see "Hello World" shown in an alert box.