Coder Social home page Coder Social logo

netcore-api's Introduction

NET 7 API

Continuous Integration

The solution includes the API to be reused.

Build and Test

To build the project, an appsetings.json file, that defines a connection, needs to be added to APICore.API project's root. Also a sample appsettings is provided in order you can duplicat it and adjust the values as per your needs.

APICore sample_appsettings.json

Is important to note, in the case of Azure, we can use developer tools instead of production environments directly from Azure on our developer machines. To accomplish this you need to use: 1- Install Microsoft Azure Storage Emulator from (https://docs.microsoft.com/en-us/azure/storage/common/storage-use-emulator). 2- Replace the Azure Connection String with this one "DefaultEndpointsProtocol=https;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=[ROOT_PATH];"

{
  "ConnectionStrings": {
    "AlBoteConnection": "Server=[YOUR_SERVER];Database=[YOUR_DATABASE];User Id=[YOUR_USERNAME];Password=[YOUR_PASWORD];",
    "Azure": "DefaultEndpointsProtocol=https;AccountName=[YOUR_ACCOUNT_NAME];AccountKey=[YOUR_ACCOUNT_KEY];BlobEndpoint=[ROOT_PATH];"
  },

  "BearerTokens": {
    "Key": "YOUR_SECRET_KEY",
    "Issuer": "API_HOST",
    "Audience": "Any",
    "AccessTokenExpirationMinutes": ACCESS_TOKEN_EXPIRATION_TIME,
    "RefreshTokenExpirationMinutes": REFRESH_TOKEN_EXPIRATION_TIME,
    "AllowMultipleLoginsFromTheSameUser": IF_YOU_MAY_ACCEPT_MULTIPLE_LOGINS,
    "AllowSignoutAllUserActiveClients": true
  },

"Blobs": {
    "ImagesRootPath": "[ROOT_PATH]/[CONTAINER_NAME]",
    "ImagesContainer": "[CONTAINER_NAME]"
  },
 "SendGrid": {
    "SendGridKey": "[SENDGRID_KEY]",
	"SendGridUser": "[SENDGRID_USER]",
    "UseSandbox": "true"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },
  "AllowedHosts": "*"
}

Database

As per requisite you must have installed .Net 7 and EF 7 Command Line tools (https://docs.microsoft.com/en-us/ef/core/miscellaneous/cli/dotnet).

We are using the .net migrations system to update the database.

In order to generate migrations for add, delete or update entities execute the following command in the Data project's root CLI:

dotnet ef migrations add NameOfTheMigration -s ..\APICore.API

Next, in order to reflect these changes in the database execute:

dotnet ef database update -s ..\APICore.API

#Blob Need Blob account azure (or use developer storage emulator). [ROOT_PATH] the root path of the Blob. [CONTAINER_NAME] name of the image container.

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.