libcex  1.0.0
Modern C++11 embedded webserver library
filesystem.hpp
Go to the documentation of this file.
1 //*************************************************************************
2 // File filesystem.hpp
3 // Date 24.05.2018 - #1
4 // Copyright (c) 2018-2018 by Patrick Fial
5 //-------------------------------------------------------------------------
6 // Filesystem functions
7 // Middleware that loads content from local filesystem
8 //*************************************************************************
9 
10 #ifndef __FILESYSTEM_HPP__
11 #define __FILESYSTEM_HPP__
12 
37 //***************************************************************************
38 // includes
39 //***************************************************************************
40 
41 #include <string>
42 #include <core.hpp>
43 
44 namespace cex
45 {
46 
47 //**************************************************************************
48 // Middlewares
49 //***************************************************************************
50 // Security
51 //***************************************************************************
52 
58 {
61 
62  std::string rootPath;
65  std::string defaultEncoding;
66 };
67 
74 MiddlewareFunction filesystem(std::string aPath);
75 
82 MiddlewareFunction filesystem(std::shared_ptr<FilesystemOptions> opts= nullptr);
83 
84 //***************************************************************************
85 } // namespace cex
86 
87 #endif // __FILESYSTEM_HPP_
FilesystemOptions()
Constructs a new options object with defaultEncoding utf-8 and empty rootPath.
Definition: filesystem.hpp:60
std::function< void(Request *req, Response *res, std::function< void()> next)> MiddlewareFunction
A function which is called by a standard Middleware when an incoming request matches.
Definition: core.hpp:108
std::string rootPath
Specifies the root-path on the local filesystem.
Definition: filesystem.hpp:62
Contains all options for the filesystem middleware.
Definition: filesystem.hpp:57
libcex core classes and functions
std::string defaultEncoding
The default encoding set in the Content-Type header.
Definition: filesystem.hpp:65