loentar / ngrest

Fast and easy C++ RESTful WebServices framework
Apache License 2.0
465 stars 94 forks source link

Cant access ngrest service from another computer #56

Closed hoang408 closed 6 years ago

hoang408 commented 6 years ago

Unable to configure ngrest on my Ubuntu 18.04 VM, I install ngrest on my Windows 7 following this guide: github.com/loentar/ngrest/wiki/Installation-guide-with-screenshots-Windows

I then have nginx installed following this guide: nginx.org/en/docs/windows.html

I run nginx.exe, and try creaing the generic echo project with ``

ngrest create echo
cd echo
ngrest

This the error log I got:

Building project echo...
In file included from C:/ngrest/echo/echo/src/echo.cpp:4:0:
C:/ngrest/echo/echo/src/echo.h:29:45: error: return type specification for constructor invalid
 std::string echo(const std::string& text);
                                             ^
C:/ngrest/echo/echo/src/echo.cpp:6:47: error: return type specification for constructor invalid
 std::string echo::echo(const std::string& text)
                                               ^
C:/ngrest/echo/echo/src/echo.cpp: In constructor 'echo::echo(const string&)':
C:/ngrest/echo/echo/src/echo.cpp:8:21: error: returning a value from a constructor
     return "Hi, " + text;
                     ^~~~
make[2]: *** [echo/CMakeFiles/echo.dir/build.make:76: echo/CMakeFiles/echo.dir/src/echo.cpp.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:86: echo/CMakeFiles/echo.dir/all] Error 2
make: *** [Makefile:84: all] Error 2

I delete that folder and try pets instead:

ngrest create pets
cd pets

The .cpp and .h files are modified as the pets sample code, and this is executed:

ngrest

This works fine on my local machine. However, trying to access it from a browser on another computer fails. Am I doing anything wrong? The Windows installation file does not specified any configuration step for either ngrest or nginx.

loentar commented 6 years ago

When you tried to create service named echo codegen created a default echo operation, which matched service name and constructor. The service name should be echo (try Echo instead).

How you try to access it from another compuer? I mean which URL do you enter from another host?

Unfortunately, deploying under nginx under Windows not supported. But you can try Linux compatibility layer under Win 10 and install ngrest using Linux installation manual.

loentar commented 6 years ago

Consider this as a local problem with firewall or network configuration.

hoang408 commented 6 years ago

It's a firewall issue. ufw did not open the port. I opened it later, and it worked.