https://github.com/code-and-sorts/cookie-cs-az-func-api
Example C# Dotnet Azure Function App project using the Cookiecutter API template.
https://github.com/code-and-sorts/cookie-cs-az-func-api
api-rest azure-functions cookiecutter csharp dotnet example serverless
Last synced: 10 months ago
JSON representation
Example C# Dotnet Azure Function App project using the Cookiecutter API template.
- Host: GitHub
- URL: https://github.com/code-and-sorts/cookie-cs-az-func-api
- Owner: Code-and-Sorts
- License: mit
- Created: 2024-11-30T09:30:45.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-12-04T07:37:53.000Z (about 1 year ago)
- Last Synced: 2025-02-06T23:18:29.401Z (12 months ago)
- Topics: api-rest, azure-functions, cookiecutter, csharp, dotnet, example, serverless
- Language: C#
- Homepage:
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# KittyClaws API
> [!IMPORTANT]
> This example Dotnet Azure Function API was generated using the [Cookiecutter API](https://github.com/Code-and-Sorts/cookiecutter-api) template.
[](https://github.com/Code-and-Sorts/cookiecutter-api)
## Overview
This project is a Dotnet-based REST API built using [Azure Function Apps](https://learn.microsoft.com/en-us/azure/azure-functions/). The API leverages Azure's serverless architecture, allowing you to deploy and scale functions effortlessly in the cloud. The HTTP-triggered functions serve as the endpoints for the API, providing a seamless way to handle client requests.
The REST API has the following endpoints:
- GET (by ID)
- GET (list)
- POST
- PATCH
- DELETE (soft-delete)
Dependency management is handled using [Nuget](https://www.nuget.org/), ensuring a streamlined and consistent environment for managing Dotnet packages and their dependencies.
## Features
- Azure Function Apps: Utilizes Azure's serverless platform to create scalable and efficient endpoints with HTTP triggers.
- Dotnet-Based: Written entirely in Dotnet, leveraging its rich ecosystem and libraries for rapid development.
- Nuget for Dependency Management: Manages all Dotnet dependencies with Nuget, making the development environment consistent and easy to set up.
- Cosmos DB NoSQL Account: This project uses Cosmos DB NoSQL database.
## Prerequisites
- Dotnet 8.x
- [Azure Functions Core Tools](https://github.com/Azure/azure-functions-core-tools): To run the Function Apps locally.
- [Azure CLI](https://learn.microsoft.com/en-us/cli/azure/): To deploy and manage Azure Function Apps.
- [Dotnet](https://dotnet.microsoft.com/en-us/download): Dotnet SDK and CLI
- Azure Account: An active Azure subscription for deploying the Function App.
- Cosmos DB NoSQL Account either deployed in Azure or [emulated](https://learn.microsoft.com/en-us/azure/cosmos-db/how-to-develop-emulator?tabs=docker-linux%2Ccsharp&pivots=api-nosql).
## Setup and Installation
1. Install Azure Functions Core Tools
Follow the [documentation](https://learn.microsoft.com/en-us/azure/azure-functions/functions-run-local?tabs=windows%2Cisolated-process%2Cnode-v4%2Cpython-v2%2Chttp-trigger%2Ccontainer-apps&pivots=programming-language-python#install-the-azure-functions-core-tools) to install Azure Function Core Tools based on your operating system.
2. Install Dotnet SDK
If you haven't already installed Dotnet SDK, you can do so by following the [official installation guide](https://dotnet.microsoft.com/en-us/download).
3. Install Dependencies
Install all dependencies:
```console
make install
```
To be able to run the project locally, set the environment variable values in the local.settings.json project file.
4. Run the API Locally
```console
make run
```
This command starts the local development server using the Azure Function Core Tools, where you can interact with your API endpoints.
5. Thunderclient
Included in the project is a [Thunderclient](https://www.thunderclient.com/) collection in the .thunderclient directory to easily test the locally hosted APIs.
## Development Workflow
### Adding a New Dependency
```bash
dotnet add package
```
### Removing a Dependency
```bash
dotnet remove package
```
## Running Tests
Ensure your code is working as expected by running unit tests using dotnet test:
```bash
make test-unit
```
## Repository structure
```text
├── cookiecutter-template-dotnet
├── KittyClaws.Api
│ ├── Controllers
│ ├── Functions
│ ├── Interfaces
│ ├── Properties
│ ├── Repositories
│ ├── Services
│ ├── models
│ │ ├── Dtos
│ │ ├── Entities
│ │ └── schemas
│ └── utils
└── KittyClaws.Api.Tests.Unit
├── Controllers
├── Functions
├── Repositories
├── Services
└── utils
```
## License
This project is licensed under the MIT License. See the LICENSE file for details.
---
Repository generated with [Code-and-Sorts/cookiecutter-api](https://github.com/Code-and-Sorts/cookiecutter-api).