GithubHelp home page GithubHelp logo

file-metadata-microservice's Introduction

File Metadata Microservice

The file metadata API allows clients to upload files using the multipart/form-data format. The API extracts metadata from the uploaded file, such as the file name, MIME type, and size, and returns this information in JSON format.

Installation

To use the file upload API, you need to have Node.js and npm (Node Package Manager) installed on your system.

  1. Install dependencies
$ npm install
  1. Start the API server by running the following command:
$ npm start

The API will start running on http://localhost:8080 if you don't set a env variable for PORT.

Endpoints

The API provides the following endpoints:

Default

The default route serves an HTML file as the response, that was made to be used as an interface for file upload. Accessing the root URL (/) via a GET request will return the default HTML file.

Upload Endpoint

URL: /api/fileanalyse Method: POST

This endpoint handles file upload requests. Clients should send a POST request to this endpoint with the file included in the request body as multipart/form-data.

Request Headers

The following headers are required for the upload endpoint:

  • Content-Type: Must be set to multipart/form-dat.

Request Body

The request body should contain the file to be uploaded as multipart/form-data.

Response

Upon successful file upload, the API responds with a JSON object containing the metadata of the uploaded file:

{
  "name": "example.jpg",
  "type": "image/jpeg",
  "size": 123456
}
  • name: The name of the uploaded file.
  • type: The MIME type of the uploaded file.
  • size: The size of the uploaded file in bytes.

Error Handling

If the API receives a request to an undefined endpoint, it will respond with a 404 Not Found error.

file-metadata-microservice's People

Contributors

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