Skip to content

Instantly share code, notes, and snippets.

View hakant's full-sized avatar

Hakan Tuncer hakant

View GitHub Profile
/// <summary>
/// Represents the startup process for the application.
/// </summary>
public class Startup
{
/// <summary>
/// Configures services for the application.
/// </summary>
/// <param name="services">The collection of services to configure the application with.</param>
public void ConfigureServices(IServiceCollection services)
namespace Microsoft.Examples
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Reflection;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning" Version="2.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Versioning.ApiExplorer" Version="2.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="3.0.0" />
param(
[string]$tenantId = "",
[string]$subscriptionId = "",
[string]$resourceGroupName = "",
[string]$apimServiceName = "",
[string]$clientId = "",
[string]$clientSecret = "",
[string]$apiName = "",
[string]$backendUrl = "",
[bool] $apiContainsMultipleVersions = $true
services.AddApiVersioning(o => o.ReportApiVersions = true);
[ApiVersion("1.0")]
[ApiVersion("2.0")]
[Route("api/home")]
public class HomeController : Controller
{
[HttpGet]
public string Get() => "Version 1";
[HttpGet, MapToApiVersion("2.0")]
public string GetV2() => "Version 2";
{
"swagger":"2.0",
"info":{
"version":"3.0",
"title":"Sample API 3.0",
"description":"A sample application with Swagger, Swashbuckle, and API versioning."
},
"paths":{
"/api/v3/People":{
"get":{
sudo: required
dist: trusty
language: node_js
node_js:
- '7.7.4'
services:
- docker
addons:
"use strict";
import * as nconf from 'nconf';
nconf.argv().env().file({ file: 'config.json' });
import databaseSetup from "../../infrastructure/DatabaseSetup";
import application from "../../application/application";
import { GetIdeasRequest, GetIdeasResponse } from "../../scenarios/GetIdeas";
import { InsertIdeaRequest, InsertIdeaResponse } from "../../scenarios/InsertIdea";
router.get('/', catchAsyncErrors(async function (req, res, next) {
var request = new GetIdeasRequest();
request.user = req.user;
var response = await application.ExecuteAsync<GetIdeasRequest, GetIdeasResponse>(request);
res.json(response.ideas);
}));