Skip to content

Instantly share code, notes, and snippets.

:octocat:
Developing...

Juan Luis Guerrero Minero juanluelguerre

View GitHub Profile
View SonarPublish (cmd)
@echo off
setlocal
set /p TOKEN=<sonar.token
IF [%1]==[] SET SLN="./ElGuerre.Taskin.Api.sln"
IF NOT [%1]==[] SET SLN=%1
dotnet build-server shutdown
del .\.sonarqube /S /Q
View SonarPublish (sh)
clear
TOKEN=$(<sonar.token)
if [ -z "$1" ]
then
SLN="ElGuerre.Taskin.Api.sln"
else
SLN="$1"
fi
@juanluelguerre
juanluelguerre / CodeCoverage
Last active Nov 27, 2018
Runing Tests & CodeCoverage without Visual Studio
View CodeCoverage
@echo off
SETLOCAL
IF [%1]==[] SET SOLUTION_NAME=ElGuerre.Taskin.Api.sln
IF NOT [%1]==[] SET SOLUTION_NAME=%1
IF [%2]==[] SET TEST_PROJECT=./test/ElGuerre.Taskin.Api.Tests/ElGuerre.Taskin.Api.Tests.csproj
IF NOT [%2]==[] SET TEST_PROJECT=%2
View appSettingsSerilogSection
"Serilog": {
"MinimumLevel": "Information",
"WriteTo": [
{
"Name": "Async",
"Args": {
"configure": [
{
"Name": "Console",
"Args": {
View SampleControllerNetCoreWithLogger
public ProjectsController(
IProjectService service,
ILogger<ProjectsController> logger)
{
_service = service;
_logger = logger;
}
[HttpGet]
public async Task<ActionResult<IEnumerable<ProjectModel>>> GetAll()
View NetCoreConfigSerilog
public static class Program
{
public static void Main(string[] args)
{
var host = new WebHostBuilder()
.UseKestrel()
.UseIISIntegration()
.UseContentRoot(Directory.GetCurrentDirectory())
.UseStartup<Startup>()
.ConfigureAppConfiguration((context, configBuilder) =>
@juanluelguerre
juanluelguerre / Startup.cs
Created Apr 15, 2018
Snippet to Use Swagger Configure(IApplicationBuilder app, IHostingEnvironment env)
View Startup.cs
app.UseSwagger()
.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "Taskin V1");
});
}
@juanluelguerre
juanluelguerre / Startup.cs
Created Apr 15, 2018
Snippet to Add Swagger to ConfigureServices(IServiceCollection services)
View Startup.cs
// Add Swagger
services.AddSwaggerGen(options =>
{
options.SwaggerDoc("v1",
new Info
{
Version = "v1",
Title = "Taskin API",
Description = "API to expose Taskin logic",
TermsOfService = "https://github.com/juanluelguerre/Taskin/blob/master/LICENSE"
@juanluelguerre
juanluelguerre / Startup.cs
Last active Apr 15, 2018
Using Swashbuckle with NetCORE to get standard OpenAPI
View Startup.cs
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Swashbuckle.AspNetCore.Swagger;
namespace ElGuerre.Taskin.Api
{
public class Startup
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.