Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

apostoldevel/module-FileServer

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
61 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ru

File Server

Module for Apostol CRM1.

Description

FileServer serves files stored in the database (via the file module of db-platform) over HTTP using a direct URL. Access is controlled by user permissions. Requests must comply with the API access rules.

FileServer and PGFile are complementary modules. PGFile syncs files from the database to the local filesystem; FileServer serves those files over HTTP.

How it works

  1. An HTTP GET request arrives at /file/<path>/<name>.
  2. The module authenticates the request (Bearer JWT token, session-based authorization, or SID cookie).
  3. Paths under /public/ are served using a bot session — no user authentication required.
  4. Fast path: If the file already exists on the local filesystem, it is served directly with the correct Content-Type.
  5. Slow path: The file record is fetched from the database via a PG query, base64-decoded, written to disk, and served (deferred response).

URL format

http[s]://localhost:8080/file/<path>/<name>
Parameter Required Description
<path> Yes File path
<name> Yes File name

Examples

Fetch a file:

GET /file/doc/report.pdf HTTP/1.1
Host: localhost:8080
Authorization: Bearer <access_token>

Fetch a public file (no auth required):

GET /file/public/logo.png HTTP/1.1
Host: localhost:8080

Related modules

  • PGFile — populates the filesystem: listens to PostgreSQL NOTIFY and writes files to disk when db.file records change
  • db-platform file module — database layer: db.file table, UNIX-like permissions, api.get_file, REST endpoints

Installation

Follow the build and installation instructions for Apostol (C++20).

Footnotes

  1. Apostol CRM — a template project built on the A-POST-OL (C++20) and PostgreSQL Framework for Backend Development frameworks.

About

File Server for apostol/

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages

Morty Proxy This is a proxified and sanitized view of the page, visit original site.