1"use strict";(self.webpackChunkblog=self.webpackChunkblog||[]).push([[1955],{3904:(e,t,n)=>{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>o,default:()=>d,frontMatter:()=>a,metadata:()=>i,toc:()=>c});var i=n(9115),s=n(4848),r=n(8453);const a={title:"Single-file web API services with .NET 5 and ASP.NET Core",tags:["ASP-NET-CORE","WEB-SERVICE","TOP-LEVEL-STATEMENTS"],slug:"single-file-web-service-aspnetcore"},o="Single-file web API services with .NET 5 and ASP.NET Core",l={authorsImageUrls:[]},c=[{value:"Introduction",id:"introduction",level:2}];function p(e){const t={h2:"h2",img:"img",p:"p",...(0,r.R)(),...e.components};return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{src:n(2557).A+"",width:"1800",height:"951"})}),"\n",(0,s.jsx)(t.h2,{id:"introduction",children:"Introduction"}),"\n",(0,s.jsx)(t.p,{children:"There are many ways to create a web application today. We have a lot of different platforms, frameworks, and libraries: PHP, Python, Java, NodeJS, and a dozen of others."}),"\n",(0,s.jsx)(t.p,{children:"While ASP.NET (Core) was always a good choice for developing enterprise-level web applications (with many complex web pages, some Web API endpoints, static resources, etc.),\nit's never been the best choice for creating a small web service with just a few endpoints to handle REST API requests in JSON or plain text formats."}),"\n",(0,s.jsx)(t.p,{children:"Well, that was true until .NET 5 was released last year. With support for top-level statements and new features in C# language, .NET 5 allows us to create a solid web service in just a few minutes and with a single code file."})]})}function d(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(p,{...e})}):p(e)}},2557:(e,t,n)=>{n.d(t,{A:()=>i});const i=n.p+"assets/images/simple-webservice-abc11c8c7d9c3cbcb922a91416c88af6.jpg"},8453:(e,t,n)=>{n.d(t,{R:()=>a,x:()=>o});var i=n(6540);const s={},r=i.createContext(s);function a(e){const t=i.useContext(r);return i.useMemo((function(){return"function"==typeof e?e(t):{...t,...e}}),[t,e])}function o(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:a(e.components),i.createElement(r.Provider,{value:t},e.children)}},9115:e=>{e.exports=JSON.parse('{"permalink":"/blog/single-file-web-service-aspnetcore","source":"@site/blog/2021-04-15-single-file-web-service-aspnetcore/index.md","title":"Single-file web API services with .NET 5 and ASP.NET Core","description":"Introduction","date":"2021-04-15T00:00:00.000Z","tags":[{"inline":true,"label":"ASP-NET-CORE","permalink":"/blog/tags/asp-net-core"},{"inline":true,"label":"WEB-SERVICE","permalink":"/blog/tags/web-service"},{"inline":true,"label":"TOP-LEVEL-STATEMENTS","permalink":"/blog/tags/top-level-statements"}],"readingTime":3.27,"hasTruncateMarker":true,"authors":[],"frontMatter":{"title":"Single-file web API services with .NET 5 and ASP.NET Core","tags":["ASP-NET-CORE","WEB-SERVICE","TOP-LEVEL-STATEMENTS"],"slug":"single-file-web-service-aspnetcore"},"unlisted":false,"prevItem":{"title":"Using TypeScript with WebPack in ASP.NET Core projects","permalink":"/blog/typescript-webpack-aspnetcore"},"nextItem":{"title":"CRUD operations in ASP.NET Core with EasyData library","permalink":"/blog/crud-asp-net-core-with-easydata"}}')}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.