Giter VIP home page Giter VIP logo

supamii / qttpserver Goto Github PK

View Code? Open in Web Editor NEW

This project forked from d5/node.native

102.0 16.0 35.0 11.12 MB

Build your API with C++ - Powered by Qt and Node's libuv

Home Page: https://supamii.github.io/qttpserver/

License: MIT License

C++ 50.12% C 1.54% Python 6.47% QMake 0.28% CMake 0.38% Makefile 0.35% Shell 0.36% Batchfile 0.01% M4 0.35% CSS 5.74% HTML 0.08% JavaScript 34.32%

qttpserver's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qttpserver's Issues

keep-alive does not work

I have built the example projects and when using Postman to test the end-points it fails for every other request.
After digging down it seems that connections are not being kept alive.

do you support REST hooks or web hooks ?

is it possible to enable hooks for this server. or using it limits you to polling once you were served with a request for a long operation ?

thank a lot.
adiel.

build and use mongodb driver

this is not a bug or feature request, just help needed.
Win10, vc14, x64.
to avoid a pain with a building and installing mongoDB manually,
(I'm newbie in mongodb),
I've just used usual (for Win) way : vcpkg install mongo-cxx-driver:x64-windows.
so this was downloaded with a dependencies , built and installed successfully.
however , I don't see there the includes from the example:
#include <mongo/client/dbclient.h>
it contains a number of heades like "mongoc-.h" and "mongocxx/.hpp"

could you clarify how to use mongo driver in a projects instaled via visual c++ package manager?

thank you

Cannot run it inside a pthread.

I've tried to get qttp server to run inside a thread created with pthread, however doesn't works. But if I call qttp server from main function, all works fine.

Any advices about how to fix it.

Thanks.

Threading: Race condition and crash on QttpResponse::close

Sometimes the server can run into a race condition while processing events, which leads to a memory access violation and causes the program to crash.

The main thread receives events from qt and calls the default event handler.
This eventually leads to a call to uv_write() on QttpResponse::close().

The second thread is started in HttpServer::startServer and runs a libuv event loop.

The issue seems to come from the uv_write() call in the main thread. According to the libuv devs, this call is not safe and should be moved to the event thread using uv_async_send:
https://groups.google.com/forum/#!topic/libuv/iHzv3x-VOr4

Uploading files

Hi, may I ask if QttpServer allows to upload/transfer not only JSON message with PUT/GET operations but big multimedia files or any binary file attached to a query/response? Is this possible or need to use other tools? If possible: could You provide some example please? Thanks!

Compile error on windows 10

When I compile QttpServer on windows 10 using QtCreator (with MSVC2015_64bit) I get this compile error:
QttpServer\lib\http\src\stream.cc:90: error: C2397: conversion from 'std::size_t' to 'ULONG' requires a narrowing conversion

Error linking an application

I've successfully built QttpServer, however if I try to build my application I get linking errors:

/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lnode_native
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -luv
/usr/lib64/gcc/x86_64-suse-linux/7/../../../../x86_64-suse-linux/bin/ld: cannot find -lhttp_parser
collect2: error: ld returned 1 exit status

My .pro file is:

QT -= gui

TARGET = my_server
CONFIG += c++11 console
CONFIG -= app_bundle
DEFINES += QT_DEPRECATED_WARNINGS
SOURCES += main.cpp

message('Including config files')
include($$PWD/config/config.pri)

message('Including QttpServer core files')
include($$PWD/qttpserver/core.pri)

What is the problem could be here? Wrong core.pri if application sources located outside qttpserver sources? Include some more?

multiple routes in one Action

please assist with an understanding the API
could you provide with a sample code (in case of this is possible technically),
when one class registers a number of routes , how e.g. OnGet methos can recognize from which route/uri this was called?
and also parsing URL parameters like /?param1=value&param2=value2

Allow CommandLineParser.parse() instead of .process()

I have a complicated application that requires many commandline options to be set.
However the first thing I need to start is the HttpServer, which is pulling args directly from QCoreApplication::instance().
Because the httpServer->initialize() uses m_ComandLineParser.process(*app) it fails with "Unknown options: my-custom-parameter".

Swagger: Supply per-route description and summary for each action

Currently the Swagger description and summary of each action is used for all routes, e.g. given an Action named Foo with two routes (one GET and on POST for the usual collection interface) both routes will have the exact same description and summary (Foo->getDescription() and Foo->getSummary()) shown in Swagger.

While there may be some Actions where this makes a lot of sense, at least in the case of generic collections it does not.

My proposal would be to return maps from both these functions:

virtual const char* getDescription() const;
virtual const char* getSummary() const;

would then become

virtual const std::map<qttp::HttpPath, const char*> getDescription() const;
virtual const std::map<qttp::HttpPath, const char*> getSummary() const;

Swagger::initialize() would have to be changed accordingly.

I think this would not be such a big change, but really help with usability of the generated Swagger documentation. I'd be willing to implement this, if you don't see any roadblocks and would accept a pull request.

Build error in Windows 7 with MinGW 5.3.0

Hi there,

I've followed the steps from the main page but when I try to compile the qhttpserver.pro I get the following errors:

WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/*.c
WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/win/*.c
WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/*.c
WARNING: Failure to find: C:/QttpServer/lib/libuv_qmake/../libuv/src/win/*.c
C:\QttpServer\build\debug\lib\libuv_qmake\Makefile.Debug:113: warning: overriding recipe for target 'debug/*.o'
C:\QttpServer\build\debug\lib\libuv_qmake\Makefile.Debug:110: warning: ignoring old recipe for target 'debug/*.o'
fatal error: cannot specify -o with -c, -S or -E with multiple files

Any suggestions?

I'm using Qt 5.7 on Windows 7 (32-bit).

Async responses

Hello! I see that the examples handle the request synchronously (in onGet for instance). What about async responses? Can I somehow send the response once some processing is completed without keeping that thread busy?
Thanks.

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.