Although I spend most of my time in C# land, I like to explore other programming languages to stretch my brain. Recently I was looking again at TypeScript where I noticed the concept of Template Literal Types . How to explain Template Literal Types? Not easy to give a good explanation. But let’s give it a try: Template Literal Types are string literals on steroids. Add a type variable to a Template Literal and Typescript will create a type with all the possible combinations for you. This allows you to compose types from others in a quick and easy way. Not clear yet? Maybe I should switch to an example: I’ve created a string literal ‘Person’ and a Template Literal Type ‘Greeting’ using the string literal. Now only valid combinations of the two are possible: Of course this is a contrived example, let us create a more realistic one for example to specify a valid padding value:
While browsing through Github, I discovered the following project: Data API builder for Azure Databases (DAB). With data API builder, database objects can be exposed via REST or GraphQL endpoints so that your data can be accessed using modern techniques on any platform, any language, and any device. With an integrated and flexible policy engine, native support for common behavior like pagination, filtering, projection and sorting, the creation of CRUD backend services can be done in minutes instead of hours or days, giving developers an efficiency boost like never seen before. Sounds cool and a perfect fit for a small application where you only need an API to expose some data. Let’s give it a try! Setup Data API builder provides a CLI tool to help us with the configuration and the setup of our project. Install the tool using the following command: dotnet tool install --global Microsoft.DataApiBuilder Now that the tool is installed successfully, we need to create a co