Giter Site home page Giter Site logo

salisuwy / gifstore Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 2.66 MB

A RESTful API developed in ASP.NET Core and SQLite for uploading and sharing image files

License: GNU General Public License v3.0

C# 100.00%
asp-net-core csharp netcore-webapi rest-api webapi

gifstore's Introduction

GifStore REST API

Overview

  • This RESTful API is developed in ASP.NET Core and SQLite.
  • The API allows authenticated users to upload GIF images.
  • Uploaded items are by private by default and can only be accessed by the owner.
  • Owners can change the access of their items to public so that other users can view

Demo

Demo.-.REST.API.mp4

Frontend

Set Up

  • Clone the repo and execute the project. The database is already seeded with random data and images using Bogus faker
  • To easy with the demo, two files are provided
    • RestClient.http: You need to install the HttpClient extension for vscode or visual studio to use this file
    • RestPostman.json: You can import this into Postman to access the endpoints

Endpoint Guides:

  • Five user accounts are already registered with seeded data. Check the GifStore/Utilities/DatabaseSeeder.cs
  • You can register and account if you want or login with one of the users (email: [email protected] ==> password: Password1)
  • Login should generate a Json Web Token (JWT)
  • Protected endpoints needs JWT added o the header of the request ("Authorisation": "Bearer )

CORS and Frontend Access

  • To allow access to your SPA or via any frontend, you need to allow CORS access to the SPA domain. You can do this in two (2) ways:
    • appsettings.json (Recommended): Modify the CORS:Domain entry in the appsettings.json to match you app domain
    • Program.cs: Add the domain entries in the AddCors middleware in the Program.cs file

Re-seeding data and Changing Database Engine

  • SQLite may not be the ideal database for a production application. To switch the database engine,
    • Add the DB connection string to appsettings.json or modify the existing one
    • If new entry is added, you need to alter the setting in Program.cs
  • To re-seed the data, send an OPTIONS request to the endpoint "api/users/seed-data". It should be easy using swagger

Changing Filestorage mechanism

  • The IFileManager interface can be implemented. I only provide an implementation for LocalFileManager which saves the files locally. AzureStorage, S3 of Google file storage can be implemented

gifstore's People

Contributors

salisuwy avatar

Stargazers

 avatar  avatar

Watchers

 avatar  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.