Movatterモバイル変換


[0]ホーム

URL:


CTRL K
    Documentation

    Documentation

    With the GenHTTP framework, developers can quickly create new web services.Everything else is provided by the server infrastructure as well as the excellentecosystem of .NET which easily allows to build, test, and run applications.

    Similar to other frameworks like Nancy, embedio, NetCoreServer, or Watson, and in comparison to ASP.NET,GenHTTP emphasizes a gentle learning curve to enable fast results. You should be able to setup a new web serviceor website in a couple of minutes.

    Getting Started

    This section shows how to create a new project from scratch using project templates and how to extend your existing application by embedding the GenHTTP engine.

    🌐
    This is a brief overview to get you running. You might want to have a lookat thetutorials for detailed step-by-step guides.

    New Project

    Project templates can be used to create apps for typical use cases with little effort. After installing the.NET SDK and the templates viadotnet new -i GenHTTP.Templates in the terminal, the templates are available via the console or directly in Visual Studio:

    GenHTTP template projects in Visual Studio

    To create a project by using the terminal, create a new folder for your app and use one of the following commands:

    TemplateCommandDocumentation
    REST Webservicedotnet new genhttp-webserviceWebservices
    REST Webservice (single file)dotnet new genhttp-webservice-minimalFunctional Handlers
    REST Webservice (controllers)dotnet new genhttp-webservice-controllersControllers
    Websocketdotnet new genhttp-websocketWebsockets
    Server Sent Events (SSE)dotnet new genhttp-sseServer Sent Events
    Website (Static HTML)dotnet new genhttp-website-staticStatics Websites
    Single Page Application (SPA)dotnet new genhttp-spaSingle Page Applications (SPA)

    After the project has been created, you can run it viadotnet run and access the server via http://localhost:8080.

    Extending Existing Apps

    If you would like to extend an existing .NET application, just add a nuget reference to theGenHTTP.Core nuget package. You can then spawn a new server instance with just a few lines of code:

    var content = Content.From(Resource.FromString("Hello World!"));var server = Host.Create()                 .Handler(content)                 .Defaults()                 .StartAsync();// or .RunAsync() to block until the application is shut down

    When you run this sample it can be accessed in the browser via http://localhost:8080.

    Next Steps

    The example project above gives you a basic idea on how projects developedwith the GenHTTP may look like. To create more complex web applications,follow the guides in the following sections:

    Create a new projectImplement your serviceTest your logicRun your appDeploy your app

    Share



    [8]ページ先頭

    ©2009-2025 Movatter.jp