-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create backend endpoint #15
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
513a8a3
build: build a simple cmake project
csirianni 16ee1a0
chore: add some .gitignore files
csirianni 24161a0
docs: add README
csirianni 25e6d67
build: add Makefile with CMake commands
csirianni 6947f2e
Merge branch 'main' into 8-create-backend-endpoint
csirianni 4b55652
chore: update .gitignore
csirianni 099e511
build: follow Conan 2.0 simple CMake project tutorial
csirianni 442dd4f
build: use conanfile.py instead of conanfile.txt
csirianni 537c759
docs: add conan command to README
csirianni 899e58c
build: change c build to c++ build
csirianni 448256f
build: switch import from zlib to Crow
csirianni 92904ec
docs: update README with correct cmake command
csirianni 80cd745
feat: create hello world application
csirianni 40d7152
docs: update set up instructions
ni-jessica fd9ffde
feat: add success response to endpoint
ni-jessica 217e66a
changes to readme
stellaljung 874c4fb
docs: update README.md
csirianni File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/build | ||
CMakeUserPresets.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cmake_minimum_required(VERSION 3.27) | ||
project(backend) | ||
|
||
find_package(Crow REQUIRED) | ||
|
||
add_executable(${PROJECT_NAME} src/main.cpp) | ||
target_link_libraries(${PROJECT_NAME} Crow::Crow) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Backend | ||
|
||
## Configuration | ||
|
||
In `/backend`, install conan: | ||
|
||
```bash | ||
brew install conan cmake | ||
conan install . --output-folder=build --build=missing | ||
``` | ||
|
||
Set up the `/build/` folder: | ||
|
||
```bash | ||
mkdir build && cd build | ||
cmake .. -DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake -DCMAKE_BUILD_TYPE=Release | ||
cmake --build . | ||
``` | ||
|
||
From `/backend`, start the server: | ||
|
||
```bash | ||
cd build && ./backend | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from conan import ConanFile | ||
|
||
|
||
class BackendRecipe(ConanFile): | ||
settings = "os", "compiler", "build_type", "arch" | ||
generators = "CMakeToolchain", "CMakeDeps" | ||
|
||
def requirements(self): | ||
self.requires("crowcpp-crow/1.0+5") | ||
|
||
def build_requirements(self): | ||
self.tool_requires("cmake/3.22.6") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <string.h> | ||
|
||
#include "crow.h" | ||
|
||
int main(void) { | ||
// delcare crow application | ||
crow::SimpleApp app; | ||
|
||
// define endpoint at the root directory | ||
CROW_ROUTE(app, "/")([](){ | ||
crow::json::wvalue response; | ||
response["status"] = "success"; | ||
return response; | ||
}); | ||
|
||
// set the port, set the app to run on multiple threads, and run the app | ||
app.port(18080).multithreaded().run(); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
praise: yum!