This project is a Typescript NodeJS-based REST API built using Azure Function Apps. 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 Yarn, ensuring a streamlined and consistent environment for managing node packages and their dependencies.
-
Azure Function Apps: Utilizes Azure's serverless platform to create scalable and efficient endpoints with HTTP triggers.
-
Typescript NodeJS-Based: Written entirely in Typescript NodeJS, leveraging its rich ecosystem and libraries for rapid development.
-
Yarn for Dependency Management: Manages all node dependencies with Yarn, making the development environment consistent and easy to set up.
-
Cosmos DB NoSQL Account: This project uses Cosmos DB NoSQL database.
-
NodeJS >=18.x, <=20.x
-
Azure Functions Core Tools: To run the Function Apps locally.
-
Azure CLI: To deploy and manage Azure Function Apps.
-
Yarn: For dependency management.
-
Azure Account: An active Azure subscription for deploying the Function App.
-
Cosmos DB NoSQL Account either deployed in Azure or emulated.
-
Install Azure Functions Core Tools
Follow the documentation to install Azure Function Core Tools based on your operating system.
-
Install Yarn
If you haven't already installed Yarn, you can do so by following the official installation guide.
-
Install Dependencies
Install all dependencies:
yarn
To be able to run the project locally, set the environment variable values in the .env project file.
-
Run the API Locally
yarn build yarn start
This command starts the local development server using the Azure Function Core Tools, where you can interact with your API endpoints.
-
Thunderclient
Included in the project is a Thunderclient collection in the .thunderclient directory to easily test the locally hosted APIs.
yarn add <package-name>
yarn remove <package-name>
Ensure your code is working as expected by running unit tests using pytest:
yarn test:unit
└── cookiecutter-template-typescript
├── .thunderclient - Thunderclient collection
├── config - Depency injection config
├── controller - Controllers
├── functions - Function App methods
├── repository - Cosmos DB repository
├── service - Services
├── types - Zod models and errors
└── utils - Error detect & response generator utilities
This project is licensed under the MIT License. See the LICENSE file for details.
Repository generated with Code-and-Sorts/cookiecutter-api.