Added ngrest project structure and absolutehumidity rest
This commit is contained in:
32
RestServer/humidityserver/CMakeLists.txt
Normal file
32
RestServer/humidityserver/CMakeLists.txt
Normal file
@@ -0,0 +1,32 @@
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
project (humidityserver CXX)
|
||||
|
||||
set(HUMIDITYSERVER_HEADERS humidityserver.h)
|
||||
|
||||
set(PROJECT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
set(HUMIDITYSERVER_CODEGEN_DIR "${PROJECT_BINARY_DIR}/codegen")
|
||||
|
||||
PREPEND(HUMIDITYSERVER_HEADERS_PATHS ${PROJECT_SOURCE_DIR} ${HUMIDITYSERVER_HEADERS})
|
||||
|
||||
CODEGEN_FILES(HUMIDITYSERVER_CODEGEN_SOURCES ${HUMIDITYSERVER_CODEGEN_DIR} ${HUMIDITYSERVER_HEADERS})
|
||||
|
||||
add_custom_command(OUTPUT ${HUMIDITYSERVER_CODEGEN_SOURCES}
|
||||
COMMAND ${NGREST_BIN_PATH}ngrestcg -i "${PROJECT_SOURCE_DIR}" -o ${HUMIDITYSERVER_CODEGEN_DIR} -t service ${HUMIDITYSERVER_HEADERS}
|
||||
DEPENDS ${HUMIDITYSERVER_HEADERS_PATHS}
|
||||
)
|
||||
|
||||
file(GLOB HUMIDITYSERVER_SOURCES ${PROJECT_SOURCE_DIR}/*.cpp)
|
||||
|
||||
list(APPEND HUMIDITYSERVER_SOURCES ${HUMIDITYSERVER_CODEGEN_SOURCES})
|
||||
|
||||
include_directories(${PROJECT_SOURCE_DIR} $ENV{NGREST_EXT_INCLUDES})
|
||||
|
||||
add_library(humidityserver MODULE ${HUMIDITYSERVER_SOURCES})
|
||||
|
||||
set_target_properties(humidityserver PROPERTIES PREFIX "")
|
||||
set_target_properties(humidityserver PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY "${PROJECT_SERVICES_DIR}"
|
||||
)
|
||||
|
||||
target_link_libraries(humidityserver ngrestutils ngrestcommon ngrestjson ngrestengine $ENV{NGREST_EXT_LIBS})
|
14
RestServer/humidityserver/src/humidityserver.cpp
Normal file
14
RestServer/humidityserver/src/humidityserver.cpp
Normal file
@@ -0,0 +1,14 @@
|
||||
// This file generated by ngrestcg
|
||||
// For more information, please visit: https://github.com/loentar/ngrest
|
||||
|
||||
#include "humidityserver.h"
|
||||
|
||||
/*std::string humidityserver::echo(const std::string& text)
|
||||
{
|
||||
return "Hi, " + text;
|
||||
}*/
|
||||
|
||||
float humidityserver::absolutehumidity(float temperature, float humidity) {
|
||||
|
||||
return temperature + humidity;
|
||||
}
|
25
RestServer/humidityserver/src/humidityserver.h
Normal file
25
RestServer/humidityserver/src/humidityserver.h
Normal file
@@ -0,0 +1,25 @@
|
||||
// This file generated by ngrestcg
|
||||
// For more information, please visit: https://github.com/loentar/ngrest
|
||||
|
||||
#ifndef HUMIDITYSERVER_H
|
||||
#define HUMIDITYSERVER_H
|
||||
|
||||
#include <ngrest/common/Service.h>
|
||||
|
||||
//! Dummy description for the service
|
||||
/*! Some detailed description of the service */
|
||||
// '*location' comment sets resource path for this service
|
||||
// *location: humidityserver
|
||||
class humidityserver: public ngrest::Service
|
||||
{
|
||||
public:
|
||||
// *method: GET
|
||||
// *location: /abshum?temperature={temperature}&humidity={humidity}
|
||||
float absolutehumidity(float temperature, float humidity);
|
||||
};
|
||||
|
||||
|
||||
#endif // HUMIDITYSERVER_H
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user