        void validate()
        {
            if (!validated_)
            {

#ifndef CROW_DISABLE_STATIC_DIR

                // stat on windows doesn't care whether '/' or '\' is being used. on Linux however, using '\' doesn't work. therefore every instance of '\' gets replaced with '/' then a check is done to make sure the directory ends with '/'.
                std::string static_dir_(CROW_STATIC_DIRECTORY);
                std::replace(static_dir_.begin(), static_dir_.end(), '\\', '/');
                if (static_dir_[static_dir_.length() - 1] != '/')
                    static_dir_ += '/';

                route<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([static_dir_](crow::response& res, std::string file_path_partial) {
                    utility::sanitize_filename(file_path_partial);
                    res.set_static_file_info_unsafe(static_dir_ + file_path_partial);
                    res.end();
                });

#if defined(__APPLE__) || defined(__MACH__)
                if (!router_.blueprints().empty())
#endif
                {
                    for (Blueprint* bp : router_.blueprints())
                    {
                        if (!bp->static_dir().empty())
                        {
                            // stat on windows doesn't care whether '/' or '\' is being used. on Linux however, using '\' doesn't work. therefore every instance of '\' gets replaced with '/' then a check is done to make sure the directory ends with '/'.
                            std::string static_dir_(bp->static_dir());
                            std::replace(static_dir_.begin(), static_dir_.end(), '\\', '/');
                            if (static_dir_[static_dir_.length() - 1] != '/')
                                static_dir_ += '/';

                            bp->new_rule_tagged<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([bp, static_dir_](crow::response& res, std::string file_path_partial) {
                                utility::sanitize_filename(file_path_partial);
                                res.set_static_file_info_unsafe(static_dir_ + file_path_partial);
                                res.end();
                            });
                        }
                    }
                }
#endif

                router_.validate();
                validated_ = true;
            }
        }
        void validate()
        {
            if (!validated_)
            {

#ifndef CROW_DISABLE_STATIC_DIR

                 
                std::string static_dir_(CROW_STATIC_DIRECTORY);
                std::replace(static_dir_.begin(), static_dir_.end(), '\\', '/');
                if (static_dir_[static_dir_.length() - 1] != '/')
                    static_dir_ += '/';

                route<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([static_dir_](crow::response& res, std::string file_path_partial) {
                    utility::sanitize_filename(file_path_partial);
                    res.set_static_file_info_unsafe(static_dir_ + file_path_partial);
                    res.end();
                });

#if defined(__APPLE__) || defined(__MACH__)
                if (!router_.blueprints().empty())
#endif
                {
                    for (Blueprint* bp : router_.blueprints())
                    {
                        if (!bp->static_dir().empty())
                        {
                             
                            std::string static_dir_(bp->static_dir());
                            std::replace(static_dir_.begin(), static_dir_.end(), '\\', '/');
                            if (static_dir_[static_dir_.length() - 1] != '/')
                                static_dir_ += '/';

                            bp->new_rule_tagged<crow::black_magic::get_parameter_tag(CROW_STATIC_ENDPOINT)>(CROW_STATIC_ENDPOINT)([bp, static_dir_](crow::response& res, std::string file_path_partial) {
                                utility::sanitize_filename(file_path_partial);
                                res.set_static_file_info_unsafe(static_dir_ + file_path_partial);
                                res.end();
                            });
                        }
                    }
                }
#endif

                router_.validate();
                validated_ = true;
            }
        }