{"id":29979576,"url":"https://github.com/daulet/servernet","last_synced_at":"2025-08-04T13:06:04.909Z","repository":{"id":39005511,"uuid":"80087621","full_name":"daulet/servernet","owner":"daulet","description":"Azure Functions made easy","archived":false,"fork":false,"pushed_at":"2022-07-22T03:28:46.000Z","size":355,"stargazers_count":3,"open_issues_count":7,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2023-03-04T22:41:49.202Z","etag":null,"topics":["azure-functions","serverless","serverless-framework"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daulet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-26T05:05:26.000Z","updated_at":"2022-07-22T03:28:43.000Z","dependencies_parsed_at":"2022-09-12T19:00:34.183Z","dependency_job_id":null,"html_url":"https://github.com/daulet/servernet","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"purl":"pkg:github/daulet/servernet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daulet%2Fservernet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daulet%2Fservernet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daulet%2Fservernet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daulet%2Fservernet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daulet","download_url":"https://codeload.github.com/daulet/servernet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daulet%2Fservernet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268699233,"owners_count":24292432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["azure-functions","serverless","serverless-framework"],"created_at":"2025-08-04T13:06:01.858Z","updated_at":"2025-08-04T13:06:04.875Z","avatar_url":"https://github.com/daulet.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ServerNET\n*Azure Functions made easy.*\n\nDeclare your Azure Function triggers, inputs and outputs in code:\n``` cs\n[HttpOutput]\npublic static async Task\u003cHttpResponseMessage\u003e RunAsync(\n    [HttpTrigger(HttpMethod.Post, \"users/{username:alpha}\")] HttpRequestMessage request,\n    string username,\n    [Table(\"User\", partitionKey: \"{username}\", rowKey: \"payment\")] PaymentInstrument paymentInstrument,\n    [Queue(\"user-queue\")] IAsyncCollector\u003cPaymentInstrument\u003e paymentQueue,\n    TraceWriter log)\n{\n    // your code here\n}\n```\nand then use servernet command line tool to generate Azure Functions release package:\n```\nservernet.CLI.exe -a Servernet.Samples.DocumentationSamples.dll -o release/path\n```\nthat will copy your assembly with its dependencies and generate *project.json* that is ready to deploy:\n``` \n{\n  \"disabled\": false,\n  \"scriptFile\": \"Servernet.Samples.DocumentationSamples.dll\",\n  \"entryPoint\": \"Servernet.Samples.DocumentationSamples.ReadmeFunction.RunAsync\",\n  \"bindings\": [\n    {\n      \"direction\": \"out\",\n      \"name\": \"$return\",\n      \"type\": \"http\"\n    },\n    {\n      \"authLevel\": \"Anonymous\",\n      \"direction\": \"in\",\n      \"methods\": [\n        \"POST\"\n      ],\n      \"name\": \"request\",\n      \"route\": \"users/{username:alpha}\",\n      \"type\": \"httpTrigger\"\n    },\n    {\n      \"connection\": \"ReadmeFunction_input_table_paymentInstrument\",\n      \"direction\": \"in\",\n      \"filter\": null,\n      \"name\": \"paymentInstrument\",\n      \"partitionKey\": \"{username}\",\n      \"rowKey\": \"payment\",\n      \"tableName\": \"User\",\n      \"take\": 0,\n      \"type\": \"table\"\n    },\n    {\n      \"connection\": \"ReadmeFunction_output_queue_paymentQueue\",\n      \"direction\": \"out\",\n      \"name\": \"paymentQueue\",\n      \"queueName\": \"user-queue\",\n      \"type\": \"queue\"\n    }\n  ]\n}\n```\n\n## Using command line tool\n\nUsing [Azure Functions CLI](https://www.npmjs.com/package/azure-functions-cli) create a new Function App, and then generate a function from your binary: \n```\nservernet.CLI.exe -a assembly.dll -f Namespace.Type.FunctionName -o release/path\n```\nOr generate functions for all types decorated with [AzureFunction] in the assembly:\n```\nservernet.CLI.exe -a assembly.dll -o release/path\n```\nReady to run it? Follow [these steps](https://blogs.msdn.microsoft.com/appserviceteam/2017/03/16/publishing-a-net-class-library-as-a-function-app/) to configure you Function App as Visual Studio project. If you are going to test it locally be sure to setup connection strings in appsettings.json (you most likely will need to set *IsEncrypted: false*), but if you are not sure how, just start running the app locally, the console prompt will guide you.\n\n## Using [AzureFunction] attribute\n\nUse [AzureFunction] attribute to let command line tool to autodetect functions to generate ([see above](#using-command-line-tool)), or to override parameters like *Disabled* and *Name*:\n```cs\n[AzureFunction(Disabled = false, Name = \"NameToUseInAzureFunctions\")]\npublic class MyFunctionClass\n{\n    // currently expecting a single public static method defined\n}\n```\n\n# Bindings\n\n![Code + Events](./docs/code%2Bevents.jpg)\n\nAzure Functions provides binding of your code to various events/triggers. What ServerNET provides is letting you to focus on your code and generate deployable Azure Functions package, including boilerplate like *function.json* with trigger/input/output bindings and release layout of the Azure Function. ServerNET also limits you to things that are supported by Azure Functions, e.g. according to [Azure Function guidelines](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook#httptrigger) when you want to setup a webhook trigger you can't use *methods* property that you'd normally use for HTTP trigger. ServerNET provides strongly typed parameterization of your triggers, input and output parameters. What can't be enforced in design time (i.e. at compile time) is enforced at generation time (using ServerNET CLI), before you deploy to Azure, which means if there is any problem with your function definition you'll find out as soon as possible.\n\nThis library supports all the same trigger, input and output parameters as Azure Functions. Few exceptions are patterns that are bad practice, e.g. *out HttpResponseMessage* parameter. Pick entry method/function (currently only *public static* methods are supported) for your logic, decorate it with provided attributes and ServerNET CLI will generate deployable Azure Functions for you:\n\n| Kind | Trigger | Input | Output |\n| ---- | :-----: | :---: | :----: |\n| [HTTP](#http-and-webhook-bindings) | [✔](#http-trigger) | | [✔](#http-output) |\n| [WebHook](#http-and-webhook-bindings) | [✔](#webhook-trigger) | | [✔](#http-output) |\n| [Timer](#timer-bindings) | [✔](#timer-trigger) | | |\n| [Storage Blob](#blob-bindings) | [✔](#blob-trigger) | [✔](#blob-input) | [✔](#blob-output) |\n| [Storage Queue](#queue-bindings) | [✔](#queue-trigger) | | [✔](#queue-output) |\n| [Storage Table](#table-bindings) | | [✔](#table-input) | [✔](#table-output) |\n\n## HTTP and WebHook bindings\n\nFor complete documentation on how to use HTTP and WebHook parameters in Azure Functions see [official documentaion](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook). For complete example that uses HTTP request and response see [HttpOutputFunction](./samples/DocumentationSamples/HttpOutputFunction.cs).\n\n### HTTP Trigger\n\nDecorate your entry method parameter with [HttpTrigger] attribute ([sample](./samples/DocumentationSamples/HttpTriggerFunction.cs)). Below is the list of parameter types that can be used with [HttpTrigger] attribute:\n* [HttpRequestMessage](https://msdn.microsoft.com/en-us/library/system.net.http.httprequestmessage(v=vs.118).aspx);\n* Custom type, request body will be deserialized from JSON into your object;\n\n### WebHook Trigger\n\nDecorate your entry method parameter with [WebHookTrigger] attribute ([sample](./samples/DocumentationSamples/WebHookTriggerFunction.cs)). Works with the same parameter types as [HTTP Trigger](#http-trigger).\n\n### HTTP Output\n\nDecoreate your entry method (not parameter) with [HttpOutput] attribute ([sample](./samples/DocumentationSamples/HttpOutputFunction.cs)). Using *out HttpResponseMessage* parameter is bad practice, hence only return parameter is supported (including async option with Task\\\u003cHttpResponseMessage\\\u003e). Below is the list of parameter types that can be used with [HttpResponse] attribute:\n* [HttpResponseMessage](https://msdn.microsoft.com/en-us/library/system.net.http.httpresponsemessage(v=vs.118).aspx), including async equivalent Task\\\u003cHttpResponseMessage\\\u003e;\n\n## Timer bindings\n\nFor complete documentation on how to use Timer parameters in Azure Functions see [official documentaion](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer).\n\n### Timer Trigger\n\nDecorate your entry method parameter with \\[[TimerTrigger](https://github.com/Azure/azure-webjobs-sdk-extensions/wiki/TimerTrigger)\\] attribute ([sample](./samples/DocumentationSamples/TimerTriggerFunction.cs)). Below is the list of parameter types that can be used with [TimerTrigger] attribute:\n* [TimerInfo](https://github.com/Azure/azure-webjobs-sdk-extensions/blob/master/src/WebJobs.Extensions/Extensions/Timers/TimerInfo.cs);\n\n## Blob bindings\n\nFor complete documentation on how to use Blob parameters in Azure Functions see [official documentaion](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-blob).\n\n### Blob Trigger\n\nDecorate your entry method parameter with \\[[BlobTrigger](https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/BlobTriggerAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/BlobTriggerFunction.cs)). Below is the list of parameter types that can be used with [BlobTrigger] attribute:\n* Custom type, blob will be deserialized from JSON into your object;\n* [String](https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx);\n* [TextReader](https://msdn.microsoft.com/en-us/library/system.io.textreader(v=vs.110).aspx);\n* [Stream](https://msdn.microsoft.com/en-us/library/system.io.stream(v=vs.110).aspx);\n* [ICloudBlob](https://msdn.microsoft.com/library/azure/microsoft.windowsazure.storage.blob.icloudblob.aspx);\n* [CloudBlockBlob](https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblockblob.aspx);\n* [CloudPageBlob](https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudpageblob.aspx);\n* [CloudBlobContainer](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblobcontainer.aspx);\n* [CloudBlobDirectory](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblobdirectory.aspx);\n* IEnumerable\u003c[CloudBlockBlob](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblockblob.aspx)\u003e;\n* IEnumerable\u003c[CloudPageBlob](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudpageblob.aspx)\u003e;\n* Other types deserialized [ICloudBlobStreamBinder](https://docs.microsoft.com/en-us/azure/app-service-web/websites-dotnet-webjobs-sdk-storage-blobs-how-to#icbsb);\n\n### Blob Input\n\nDecorate your entry method parameter with \\[[Blob](https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/BlobAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/BlobInputOutputFunction.cs)). Below is the list of parameter types that can be used with [Blob] attribute:\n* Custom type, blob will be deserialized from JSON into your object;\n* [String](https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx);\n* [TextReader](https://msdn.microsoft.com/en-us/library/system.io.textreader(v=vs.110).aspx);\n* [Stream](https://msdn.microsoft.com/en-us/library/system.io.stream(v=vs.110).aspx);\n* [ICloudBlob](https://msdn.microsoft.com/library/azure/microsoft.windowsazure.storage.blob.icloudblob.aspx);\n* [CloudBlockBlob](https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblockblob.aspx);\n* [CloudPageBlob](https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudpageblob.aspx);\n\n### Blob Output\n\nDecorate your entry method *out* parameter with \\[[Blob](https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/BlobAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/BlobInputOutputFunction.cs)). Below is the list of parameter types that can be used with [Blob] attribute:\n* Custom type, blob will be deserialized from JSON into your object;\n* [String](https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx);\n* [TextReader](https://msdn.microsoft.com/en-us/library/system.io.textreader(v=vs.110).aspx);\n* [Stream](https://msdn.microsoft.com/en-us/library/system.io.stream(v=vs.110).aspx);\n* [CloudBlobStream](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.blob.cloudblobstream.aspx);\n* [ICloudBlob](https://msdn.microsoft.com/library/azure/microsoft.windowsazure.storage.blob.icloudblob.aspx);\n* [CloudBlockBlob](https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudblockblob.aspx);\n* [CloudPageBlob](https://msdn.microsoft.com/en-us/library/azure/microsoft.windowsazure.storage.blob.cloudpageblob.aspx);\n\n## Queue bindings\n\nFor complete documentation on how to use Queue parameters in Azure Functions see [official documentaion](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-queue).\n\n### Queue Trigger\n\nDecorate your entry method parameter with \\[[QueueTrigger](hhttps://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/QueueTriggerAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/QueueTriggerFunction.cs)). Below is the list of parameter types that can be used with [QueueTrigger] attribute:\n* T, where T is the type that you want to deserialize the queue message into as JSON;\n* [String](https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx);\n* [byte](https://msdn.microsoft.com/en-us/library/5bdb6693.aspx)[];\n* [CloudQueueMessage](https://msdn.microsoft.com/library/azure/microsoft.windowsazure.storage.queue.cloudqueuemessage.aspx);\n\n### Queue Output\n\nDecorate your entry method *out* parameter with \\[[Queue](hhttps://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/QueueTriggerAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/QueueOutputFunction.cs)). Below is the list of parameter types that can be used with [Queue] attribute:\n* out T, where T is the type that you want to deserialize as JSON into queue message;\n* out [String](https://msdn.microsoft.com/en-us/library/system.string(v=vs.110).aspx);\n* out [byte](https://msdn.microsoft.com/en-us/library/5bdb6693.aspx)[];\n* out [CloudQueueMessage](https://msdn.microsoft.com/library/azure/microsoft.windowsazure.storage.queue.cloudqueuemessage.aspx);\n* ICollector\\\u003cT\\\u003e or IAsyncCollector\\\u003cT\\\u003e, where T is one of the supported types;\n\n## Table bindings\n\nFor complete documentation on how to use Table parameters in Azure Functions see [official documentaion](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-storage-table).\n\n### Table Input\n\nDecorate your entry method parameter with \\[[Table](https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/TableAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/TableInputFunction.cs)). Below is the list of parameter types that can be used with [Table] attribute:\n* T, where T is the data type that you want to deserialize the data into;\n* Any type that implements [ITableEntity](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.itableentity.aspx);\n* IQueryable\\\u003cT\\\u003e, where T is the data type that you want to deserialize the data into;\n\n### Table Output\n\nDecorate your entry method parameter with \\[[Table](https://github.com/Azure/azure-webjobs-sdk/blob/dev/src/Microsoft.Azure.WebJobs/TableAttribute.cs)\\] attribute ([sample](./samples/DocumentationSamples/TableOutputFunction.cs)). Below is the list of parameter types that can be used with [Table] attribute:\n* out \\\u003cT\\\u003e, where T is the data type that you want to serialize the data into;\n* out \\\u003cT\\\u003e, where T implements [ITableEntity](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.itableentity.aspx);\n* ICollector\\\u003cT\\\u003e, where T is the data type that you want to serialize the data into;\n* IAsyncCollector\\\u003cT\\\u003e (async version of ICollector\\\u003cT\\\u003e);\n* [CloudTable](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.storage.table.cloudtable.aspx);\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaulet%2Fservernet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaulet%2Fservernet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaulet%2Fservernet/lists"}