All Projects → osmangoninahid → cpp-rest-api

osmangoninahid / cpp-rest-api

Licence: other
RESTFul Web service by C++, implemented basic REST endpoints and RESTVerbs (GET,POST,PUT,DELETE).

Programming Languages

C++
36643 projects - #6 most used programming language

Projects that are alternatives of or similar to cpp-rest-api

DeepfakeHTTP
DeepfakeHTTP is a web server that uses HTTP dumps as a source for responses.
Stars: ✭ 373 (+2769.23%)
Mutual labels:  http-server, restful-api
http4s-good-practices
Collection of what I consider good practices in Http4s (WIP)
Stars: ✭ 74 (+469.23%)
Mutual labels:  http-server, restful-api
wine
A lightweight and flexible framework to help build elegant web API
Stars: ✭ 39 (+200%)
Mutual labels:  http-server, restful-api
Http Fake Backend
Build a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 253 (+1846.15%)
Mutual labels:  http-server, restful-api
Generator Http Fake Backend
Yeoman generator for building a fake backend by providing the content of JSON files or JavaScript objects through configurable routes.
Stars: ✭ 49 (+276.92%)
Mutual labels:  http-server, restful-api
Libhttpserver
C++ library for creating an embedded Rest HTTP server (and more)
Stars: ✭ 464 (+3469.23%)
Mutual labels:  http-server, restful-api
HttpServerLite
TCP-based simple HTTP and HTTPS server, written in C#.
Stars: ✭ 44 (+238.46%)
Mutual labels:  http-server, restful-api
Farwest
Framework for building RESTful HATEOAS-driven applications.
Stars: ✭ 18 (+38.46%)
Mutual labels:  http-server, restful-api
Restbed
Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications.
Stars: ✭ 1,551 (+11830.77%)
Mutual labels:  http-server, restful-api
open-rest-es6-boilerplate
open-rest boilerplate project with es6
Stars: ✭ 24 (+84.62%)
Mutual labels:  http-server, restful-api
waycup
A minimal tool that hides your online assets from online security scanners, researchers and hackers.
Stars: ✭ 100 (+669.23%)
Mutual labels:  http-server
gofile
HTTP/1.1 directory listing and file server using TCP sockets for fun
Stars: ✭ 59 (+353.85%)
Mutual labels:  http-server
go-sse
Fully featured, spec-compliant HTML5 server-sent events library
Stars: ✭ 165 (+1169.23%)
Mutual labels:  http-server
http-server
A Java HTTP server in 35MB Docker image
Stars: ✭ 17 (+30.77%)
Mutual labels:  http-server
go-pangu
rest api web server based on go(High availability, high security, high performance)
Stars: ✭ 45 (+246.15%)
Mutual labels:  restful-api
pycameresp
Motion detection with image notification for Esp32CAM and Esp32 flasher with GUI based on esptool.py.
Stars: ✭ 40 (+207.69%)
Mutual labels:  http-server
Text Classification TF
用tf实现各种文本分类模型,并且封装restful接口,可以直接工程化
Stars: ✭ 32 (+146.15%)
Mutual labels:  restful-api
go-zero
A cloud-native Go microservices framework with cli tool for productivity.
Stars: ✭ 23,294 (+179084.62%)
Mutual labels:  restful-api
pico
This is a very simple HTTP server for Unix, using fork(). It's very easy to use.
Stars: ✭ 83 (+538.46%)
Mutual labels:  http-server
rust-spa-auth
Example application using a Vue frontend with Rust backend that has authentication + authorization.
Stars: ✭ 45 (+246.15%)
Mutual labels:  http-server

cpp-rest-api

RESTFul CRUD Service Example by C++

Before You Begin

Before you begin we recommend you read about the basic building blocks that assemble for this application. I’m assuming that you are using Ubuntu/Linux OS

First step is to install below mods on Apache2 to enable support for FastCGI:

sudo apt-get install libapache2-mod-fastcgi libapache2-mod-fcgid

Once installed, restart the Apache2 service by calling sudo service apache2 restart.

Now it’s necessary to download and install Boost. You can do it here. Download it from the official website, unpack it and call the following commands on terminal:

./boostrap
sudo ./b2 install

And finally, download FastCGI++ through the following link: http://www.nongnu.org/fastcgipp/

The procedure to install it is the default one:

./configure
make
sudo make install

Finally, install MySQL, Initialize MySQL into terminal , Create Database name book_shop && select database :

sudo apt-get install MySQL-server
mysql -u USERNAME -p
CREATE DATABASE book_shop;
USE book_shop;

And finally let’s create a table for Book:

CREATE TABLE Book(
  id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
  name VARCHAR(30) NOT NULL,
  publisher VARCHAR(30) NOT NULL,
  date TIMESTAMP,
  edition INT
);

Now compile cpp files using :

sudo g++ *.cpp -I/usr/local/include/mysqlcppconn/ -lfastcgipp -lboost_date_time -lboost_system -lboost_thread -lmysqlcppconn -o post.fcgi

You must put the “.fcgi” extension in order to access the page. A more elegant solution would be, instead of GET /books/book.fcgi?id=10, the following: GET /books/10.

It’s shorter and now the user don’t need to know we are using a FCGI script. URL rewriting is completely possible on Apache Web Server. You just need to do the following:

sudo a2enmod rewrite
sudo service apache2 restart
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].