Proof-of-concept
							parent
							
								
									614ae1c711
								
							
						
					
					
						commit
						cae62ce7d2
					
				
							
								
								
									
										18
									
								
								src/main.cpp
								
								
								
								
							
							
						
						
									
										18
									
								
								src/main.cpp
								
								
								
								
							|  | @ -1,5 +1,8 @@ | |||
| #include "crow.h" | ||||
| 
 | ||||
| extern "C" { | ||||
| #include "ternarytrie.h" | ||||
| } | ||||
| 
 | ||||
| int main() | ||||
| { | ||||
|  | @ -7,8 +10,19 @@ int main() | |||
| 
 | ||||
|     crow::SimpleApp app; | ||||
| 
 | ||||
|     CROW_ROUTE(app, "/").methods(crow::HTTPMethod::Get, crow::HTTPMethod::Post)([](){ | ||||
|         return "Hello world"; | ||||
|     CROW_ROUTE(app, "/<string>").methods(crow::HTTPMethod::Post) | ||||
|     ([trie](std::string s){ | ||||
|         ternarytrie_add(trie, s.c_str()); | ||||
| 
 | ||||
|         return "added"; | ||||
|     }); | ||||
|     CROW_ROUTE(app, "/<string>").methods(crow::HTTPMethod::Get) | ||||
|     ([trie](std::string s){ | ||||
|      if (ternarytrie_search(trie, s.c_str())) { | ||||
|         return "it's here"; | ||||
|      } | ||||
| 
 | ||||
|      return "nope"; | ||||
|     }); | ||||
| 
 | ||||
|     app.port(18080).multithreaded().run(); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue