- Damian Edward's Minimal Playground: https://github.com/DamianEdwards/MinimalApiPlayground
- Contoso Construction API with Azure Deployment Scripts: https://github.com/bradygaster/Contoso.Construction
- .NET Conf 2021 Demo App: https://github.com/halter73/Contoso.Construction
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using Microsoft.AspNetCore.RateLimiting; | |
| using System.Threading.RateLimiting; | |
| var builder = WebApplication.CreateBuilder(args); | |
| builder.Services.AddRateLimiter(options => | |
| { | |
| // 1. Fixed Window Limiter (20 requests per 2 minutes) | |
| // ----------------------------------------------- | |
| // |----------------- 2 min -----------------| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Try.ts | |
| // By Colin Teahan | |
| // August 14th, 2024 | |
| // | |
| // This TypeScript file enables usage of the .try() method which will return a result tuple of [T?, Error?] | |
| // from any function or async function. This works by defining a new property on the global Object.prototype | |
| // and then do some type-fu. | |
| // | |
| // Example usage: | |
| // https://www.typescriptlang.org/play/?target=99#code/MYewdgziA2CmB0w4EMBOAKAlAKGwejwAJCAVVAT3gBcJ8jCAhcwgYRgEsxTZkALZMHWIBBAK4BzURCqEAjABYqvADSEATAAY18ukNK92EUuQAOsAMrBU7EzIBm7OIVhhkAIzhGpycbEIg7QiU-agosQgBbWCUQABNCAHcDYF5Ex2hCVGjRVC5kTNgIUWgZKlETJwDCAG0SAH5VAFFUVBBUOoBdPTtWiMIBZjtRMGAqdnB-VH6IchHCIZGx8Hh9Q0S2gGsjN2ZY2AcwTnF+wjBYBMITVrNUKmYJ4MJxaBA3ZAyAeTcAK1hR+CuICoQNMsD0AniwS4sRAhCgUSCoIAtEN4LoCMRGgAPZARCp+by+ABc6PoC1G4y4vioAFUILBUEwAJKxdDsWJE06iCJuBmYQgAbz0xGI7ECbPiAB4ALyEDT8pStC5nC7NVoYADknAAbu92YQpAzCOyNTgMSLiFkyrlBadcbBORqGK8Nap9QBfPSegh6UCQGTVQ2oVQM9UdQiy6l0hnM2KhcjoeWESVIpHOFptNLQDK8grWs6xX3gaQ1IMhjOocOR6LRxnkFnx9CyfkptNBwhOl3GoxWnIF0nEAByHxIjU5JAMRjW0nSJwSm2NXEB4iyECMEO7pyBcNE |
This document now exists on the official ASP.NET core docs page.
- Application
- Request Handling
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { createStyles, Paper, Table, TableBody, TableContainer, TablePagination, Theme } from '@material-ui/core'; | |
| import { makeStyles, TableCell, TableHead, TableRow, TableSortLabel } from '@material-ui/core'; | |
| import React from 'react'; | |
| interface IDataTableColumn { | |
| id: string | |
| name: string, | |
| enableSort?: boolean, | |
| align?: "center" | "inherit" | "justify" | "left" | "right" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env dotnet run | |
| var builder = WebApplication.CreateBuilder(args); | |
| var config = builder.Configuration; | |
| var connString = config["connectionString"] ?? "Data Source=todos.db"; | |
| builder.AddDbContext<TodoDb>(options => options.UseSqlite(connString)); | |
| builder.AddSqlite<Todo>(connString) // Higher level API perhaps? | |
| var app = builder.Build(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import * as React from 'react' | |
| // routing, etc. | |
| import { Reset } from '~/ui/shared/Reset' | |
| export class App extends React.Component { | |
| public render() { | |
| return ( | |
| <div> | |
| <title>Dashboard</title> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ASP.NET Core | |
| # Build and test ASP.NET Core projects targeting .NET Core. | |
| # Add steps that run tests, create a NuGet package, deploy, and more: | |
| # https://docs.microsoft.com/azure/devops/pipelines/languages/dotnet-core | |
| pool: | |
| vmImage: 'Ubuntu 16.04' | |
| variables: | |
| buildConfiguration: 'Release' |
bonus tip: for more darkness > https://darkreader.org/
NewerOlder
