GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing docs.servicestack.net — Create your first WebService Create your first WebServiceServiceStack APIs start from a different place than most frameworks. Instead of writing a method that returns JSON, you describe what the message is - and the routes, the docs, the validation, the API Explorer and the native clients are all generated from that one description. This walkthrough creates a working API from scratch, then shows exactly what each file does and what you got for free. That's it - you now have a running .NET 10 API. The template's home page is already calling it with typed DTOs! How it worksThe important detail is what isn't in your Service: no The codeWhat that one DTO gave youTIP Change the return format on any API by adding The solution structureEvery ServiceStack template scaffolds the same four projects. The layout isn't ceremony - it's what makes your API contract shareable and your logic testable: Read more in Physical Project Structure. Call your API from anywhereYour App publishes enough metadata to generate a native, typed client for any supported language - so there's no SDK project to write, version or document. Pick a language to see the two commands: Re-run the generate command whenever your API changes. New fields show up in the generated DTOs, and removed or renamed members become compile errors in the consuming App instead of runtime surprises. From a web page, with no build stepThe
Which lets you reference the package name in your source instead of its physical location:
Enable static analysis and intelli-senseFor IDE intelli-sense during development, save the annotated Typed DTOs to disk:
Then reference the local file to enable static analysis when calling your typed APIs:
To also get type-checking for @servicestack/client, install the dependency-free library as a dev dependency:
Only its TypeScript definitions are used by the IDE, so you get a rich typed authoring experience with no bundler and no additional build time:
From a component frameworkThe same
Compare the same API call across the major front-end frameworks: Native Mobile and Desktop Apps use the same approach - see Add ServiceStack Reference for Swift, Java, Kotlin, Dart and .NET clients. Where to go nextStart from a full-featured templateThe C# Project Templates OverviewFor Blazor WASM and Server see our Blazor projects & Tailwind components, and the rich Vue 3 Tailwind Components library that all Vue templates are pre-configured with. Other ways to create a projectIf you don't have the x dotnet tool installed, the quickest way to create a ServiceStack App is to download your preferred template from: Empty ProjectsThere are a few different ways you can create empty ServiceStack projects ordered by their level of emptiness. To write a minimal .NET 10 Web App to your current directory, mix in the init gist files to your current directory:
To create an empty Single Project Template solution use the empty template:
To create an empty 4 Project solution that adopts ServiceStack's recommended project structure, use the web template:
INFO You can omit the ProjectName in all above examples to use the Directory Name as the Project Name Empty F# TemplateLike C# init there's also init-fsharp gist to create an empty F# Web App:
Empty VB .NET TemplateAnd init-vb to create an empty VB .NET Web App:
On This Page
|
| You are visitor 01402894 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |