Giter Site home page Giter Site logo

crowcpp-mongo's Introduction

Crow + Mongodb

This repository is just an example of how Crowcpp and Mongodb work, you can use this template to build your web backend

Used

Conan

  • asio
  • mongo-cxx-driver
  • nlohmann_json

Submodules

  • crowcpp

Building

Create build folder

mkdir build && cd build

Install deps from Conan

conan install .. --output-folder=conan --build=missing

CMake building & compilation (Clnag), used conan toolchain file

CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release .. -G 
"Unix Makefiles" -DCMAKE_TOOLCHAIN_FILE=./conan/conan_toolchain.cmake
cmake --build . -j4

Dependencies

  • CMake 3.22
  • Conan (Python 3.10)
  • Compilers Clang/GCC

API Reference

GET localhost:18080/user

Parameter Type Description
oid string http param

POST localhost:18080/user

Parameter Type Description
oid string http param
body json json data user

PUT localhost:18080/user

Parameter Type Description
oid string http param
body json json data user

DELETE localhost:18080/user

Parameter Type Description
oid string http param

User model example raw body json:

{
    "age": 26,
    "name": "miroslaw",
    "nick": "witcherofthorns",
    "photo": "http://domain/img/file.jpg"
}

FAQ

Why didn't you use CrowCpp from Conan?

  • I couldn't use CrowCpp from Conan because I'm using the new latest version of CrowCpp v1.1.0 (Pre-Release) and it's still not available in the Conan Package Center yet. I used this particular version because it is the newest and latest version of Crow for a long time with a large number of fixes and with the transition to Asio instead of Boost

Why is everything written functionally and no classes are used?

  • Everything is written in a functional style, because I don’t see the point of using classes in a place where there is simply no point in using them, because the behavior of mongodb or crowcpp is essentially pre-defined, it’s pointless. But if you really want to use classes, you can copy all the source code and create your own simple Singleton class from it

crowcpp-mongo's People

Contributors

witcherofthorns avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.