elsa-core/samples/Sample06/HelloWorldWorkflow.cs
Sipke Schoorstra 877674619d
Added HTTP trigger & signal (#44)
* Incremental work on signaling

* Incremental work on signal middleware

* Getting somewhere!

* Refactored middelware

* Added BadRequestResult and NotFoundResult
2019-07-06 20:36:10 +02:00

27 lines
959 B
C#

using System;
using System.Net;
using Elsa.Activities.Http.Activities;
using Elsa.Core.Expressions;
using Elsa.Services;
using Elsa.Services.Models;
namespace Sample06
{
public class HelloWorldWorkflow : IWorkflow
{
public void Build(IWorkflowBuilder builder)
{
builder
.StartWith<HttpRequestTrigger>(activity => activity.Path = new Uri("/hello-world", UriKind.RelativeOrAbsolute))
.Then<HttpResponseAction>(
activity =>
{
activity.Body = new PlainTextExpression("<h1>Hello World!</h1><p>Elsa says hi :)</p>");
activity.ContentType = new PlainTextExpression("text/html");
activity.StatusCode = HttpStatusCode.OK;
activity.ResponseHeaders = new PlainTextExpression("X-Powered-By=Elsa Workflows");
}
);
}
}
}