Giter VIP home page Giter VIP logo

Welcome to BlobService

Build status Documentation Status

This repository contains BlobService for hosting on-permise. This is designed as plugable component and can be extended to store blobs in any storage.

The project is now in active development.

Full Documentation is available here.

http://blobservice.readthedocs.io

Configuration.

  1. Create new ASP.NET Core project in you solution

  2. Update WebConfig to enable DELETE and PUT method support

<system.webServer>
    <modules>
        <remove name="WebDAVModule" />
    </modules>
    <handlers>
        <remove name="WebDAV" />
    </handlers>
  1. Install folowing Nuget packages
Install-Package BlobService.Core
Install-Package BlobService.MetaStore.EntityFrameworkCore
Install-Package BlobService.Storage.FileSystem
  1. Add folowing code to your Startup.cs
//Usings

using BlobService.Core.Configuration;
using BlobService.MetaStore.EntityFrameworkCore;
using BlobService.MetaStore.EntityFrameworkCore.Configuration;
using BlobService.Storage.FileSystem;
using BlobService.Storage.FileSystem.Configuration;
public class Startup
{
    public void ConfigureServices(IServiceCollection services)
    {
    	// Cors Policy
        services.AddCors(opts =>
            {
                opts.AddPolicy("AllowAllOrigins",
                builder =>
                {
                    builder.AllowAnyOrigin()
                    .AllowAnyMethod()
                    .AllowCredentials();

                });
            });
    
    
    	// Add DB Context
        services.AddDbContext<BlobServiceContext>(opts =>
            {
            	// Example
                opts.UseSqlServer("Server=(localdb)\\mssqllocaldb;Database=BS;Trusted_Connection=True;MultipleActiveResultSets=true");
            });
    
        // Adds Blob services core services
        services.AddBlobService(opts =>
        {
        	opts.CorsPolicyName = "AllowAllOrigins";
            opts.MaxBlobSizeInMB = 100;
        })        
        // Registers FileSystem Storage Service for persisting files in filesystem in specified path
        .AddFileSystemStorageService<FileSystemStorageService>(opts =>
        {
            // Make sure to give Write permission to IIS User
            opts.RootPath = @"C:\blobs";
        })
        .AddEfMetaStores<BlobServiceContext>();
    }

    public void Configure(IApplicationBuilder app)
    {
        // Use BlobService Middlwares (mvc)
        app.UseBlobService();
    }
}
  1. Execute folowing command in Console
Add-Migrations

and specify name for your migration

  1. And finally execute
Update-Database

Usage.

Container Endpoints

  1. Get all containers
Method: GET
Endpoint: www.example.com/containers
  1. Add container
Method: POST
Endpoint: www.example.com/containers
Data: {"name" : "ContainerName"}
  1. Get container by name
Method: GET
Endpoint: www.example.com/containers/{name}
  1. Get all blobs from container
Method: GET
Endpoint: www.example.com/containers/{id}/blobs
  1. Update container's name
Method: PUT
Endpoint: www.example.com/containers/{id}
Data: {"name" : "NewContainerName"}
  1. Delete container
Method: DELETE
Endpoint: www.example.com/containers/{id}

BlobService's Projects

blobservice icon blobservice

asp.net core powered middleware for hosting Blob Service on premise

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.