Files
scylladb/http/api_docs.cc
Amnon Heiman c129b86589 Adding the api_docs to http
This is a migration of the api_docs from OSv. It replaces the static
api-doc.json with a dynamic generated reply, this allows to register API
in run time.

The api_registry_builder is a helper class that holds the file and api
path, simplifying registring both the api_doc handler and registering
additional API.

To use the api_doc, first generate a api_registry_builder.

The registry supply two functions, one for registring the api_doc
handler and one for registering an API.

Both function are passed as an argument for the set_routes method of the
http_server_control object.

To find the handler, the get_exact_match in the routes object was needed
to become public.

Signed-off-by: Amnon Heiman <amnon@cloudius-systems.com>
2015-04-05 11:39:48 +03:00

35 lines
1.0 KiB
C++

/*
* This file is open source software, licensed to you under the terms
* of the Apache License, Version 2.0 (the "License"). See the NOTICE file
* distributed with this work for additional information regarding copyright
* ownership. You may not use this file except in compliance with the License.
*
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
/*
* Copyright 2015 Cloudius Systems
*/
#include "api_docs.hh"
#include "handlers.hh"
#include "json/formatter.hh"
#include "transformers.hh"
using namespace std;
namespace httpd {
const sstring api_registry_builder::DEFAULT_PATH = "/api-doc";
const sstring api_registry_builder::DEFAULT_DIR = ".";
}