Web framework C++  2.0.0
Simple web framework on c++ designed to easily create web pages, etc
Public Member Functions | List of all members
FsMiddleware Class Reference

Middleware to host directories with inner files. More...

#include <fs_middleware.h>

Inheritance diagram for FsMiddleware:
Inheritance graph
Collaboration diagram for FsMiddleware:
Collaboration graph

Public Member Functions

 FsMiddleware (const char *nameID, const char *folderPath, const char *mountPath=nullptr)
 
bool autoExec () override
 
void exec () override
 
- Public Member Functions inherited from Middleware
 Middleware (const char *nameID)
 
virtual ~Middleware ()
 
void setContent (Request *request, Response *response)
 
void addValueToMap (const char *key, const char *value)
 
bool getValueFromMap (const char *key, std::string &value)
 
std::unordered_map< std::string, std::string > * getMap ()
 
std::string getNameID ()
 
virtual void clear ()
 

Additional Inherited Members

- Protected Attributes inherited from Middleware
Requestrequest
 
Responseresponse
 
std::unordered_map< std::string, std::string > * map
 

Detailed Description

Middleware to host directories with inner files.

This middleware provide an opportunity to share many files in directories and subdirectories by passing path to root directory and mount point of this directory.

Constructor & Destructor Documentation

FsMiddleware::FsMiddleware ( const char *  nameID,
const char *  folderPath,
const char *  mountPath = nullptr 
)

create FsMiddleware to serve all files from provided directory filesystem hierarchy

Parameters
nameIDstring ID of this middleware
folderPathrelative or full path to hosted folder
mountPathpath, that would be added before relative path of files and all target requests uri should begin with this mount path

Member Function Documentation

bool FsMiddleware::autoExec ( )
overridevirtual

check, if current request is file in hierarchy of hosted directory

Returns
true, if there is a needed file, false otherwise

Implements Middleware.

void FsMiddleware::exec ( )
overridevirtual

execute current middleware

Implements Middleware.


The documentation for this class was generated from the following file: