Giter VIP home page Giter VIP logo

api-restgrpc-vehicle's Introduction

Rest Api and gRPC Api for vehicle's location registers

This Api was compiled in Debian GNU/Linux using CMake and gcc, with the libraries CppRest SDK (Casablanca) for the Rest Api, gRPC library for de gRPC APi and Google Test C++ for unit test grpc.

Compile using de bash script

./compile.sh 

from the directory Api-restgrpc-vehicle

To run the servers use the command

./run_test.sh "parameter"

from the directory Api-restgrpc-vehicle where parameter is "test" to run the unit test and "prod" to run the servers

To run the docker image extract de gzip file and run the command to run the tests

sudo docker run -p 34568:34568 -p 34569:34569 -e "type_env=test" --name rg api-restgrpc-vehicle:1.0

To run the server from docker image run the command

sudo docker run -p 34568:34568 -p 34569:34569 -e "type_env=prod" --name rg api-restgrpc-vehicle:1.0

To stop and remove the container

sudo docker container stop rg

sudo docker container rm --force rg

Rest server listens on 0.0.0.0:34568 and acepts requests methods POST, PUT and DELETE.

Inserts Vehicle at ==> 0.0.0.0:34568/insert method POST
Retrieve vehicle by ID at ==> 0.0.0.0:34568/vehiclebyid method POST
Update vehicle's location by ID at ==> 0.0.0.0:34568/ method PUT
Get a list of vehicles at a given location at ==> 0.0.0.0:34568/vehiclebyarea method POST
Delete a vehicle by ID at ==> 0.0.0.0:34568/ method DELETE

gRPC server listens on 0.0.0.0:34569 and acepts requests gRPC ==> you have to create a client gRPC including the file handlergrpc.grpc.pb.h

#include "path_to_file/handlergrpc.grpc.pb.h"

And create request using the following fuctions

Inserts Vehicle at ==> function sendRequestInsert
Retrieve vehicle by ID at ==> function sendRequestGetByID
Update vehicle's location by ID at ==> function sendRequestLocation
Get a list of vehicles at a given location at ==> function sendRequestGetByArea
Delete a vehicle by ID at ==> function sendRequestDelete

A test client has been included in this repository

api-restgrpc-vehicle's People

Contributors

guscolgit 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.