Giter VIP home page Giter VIP logo

re-ml-api-tools's Introduction

ML Api tool

This is a .NET item template to ease the process of complying with the internal API guidelines in Monstarlab outlined in the (API Manifesto)[].

NuGet package dependencies

  • Newtonsoft.Json
  • FluentValidation.AspNetCore

How to use

  1. Pull repo
  2. In your terminal go to ./working/content
  3. type dotnet new install ./ to install the item template
  4. To create a new web project create an empty folder, navigate the terminal there and type dotnet new web.
  5. Apply the template by typing dotnet new mlapi -P Acme. The -P parameter is your project's name. It will replace a placeholder in various places in the item template.
  6. Install dependency dotnet add package FluentValidation.AspNetCore
  7. Install dependency dotnet add package Newtonsoft.Json
  8. Configure the webproject to use the included custom exception handler and create initial routes for testing, eg. in ./Program.cs:
using Acme.Api.Exceptions;
using Acme.Api.Middleware.Helpers;

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.UseCustomExceptionHandler(true);

app.MapGet("/", () => "Hello World!");
app.MapGet("/unauthorized", () => {
    throw new AcmeUnauthorizedAccessApiException("Unauthorized message");
});
app.MapGet("/notfound", () => {
    throw new AcmeNotFoundApiException("Not Found message");
});

app.Run();
  1. dotnet build
  2. dotnet run
  3. Test the endpoints in your browser.

re-ml-api-tools's People

Contributors

rasmusebbesen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.