Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

always got the 404 error #45

Closed
dukeduck1984 opened this issue Oct 3, 2018 · 8 comments
Closed

always got the 404 error #45

dukeduck1984 opened this issue Oct 3, 2018 · 8 comments

Comments

@dukeduck1984
Copy link

dukeduck1984 commented Oct 3, 2018

Hi,

I always got the "404 Not Found Nothing matches the given URI" error, although I could connect to the server.

The similar issue was reported here too: https://www.cnx-software.com/2017/10/16/esp32-micropython-tutorials/

I used the loboris fork of the Micropython firmware for ESP32: https://github.com/loboris/MicroPython_ESP32_psRAM_LoBo/. The MicroWebSrv module was frozen in the firmware.

Here is my code:

from microWebSrv import MicroWebSrv

ws = MicroWebSrv()

@MicroWebSrv.route('/')
def handlerFuncGet(httpClient, httpResponse):
    content = """\
    <!DOCTYPE html>
    <html>
        <h1>hello world</h1>
    </html>
    """
    print(content)

@MicroWebSrv.route('/<action>')
def handlerFuncEdit(httpClient, httpResponse, routeArgs):
    action = routeArgs['action']
    print(action)

ws.Start()

Thanks in advance for your help.

-Kaiyuan

@formica-multiuso
Copy link

Hi have the exact same issue.
Any idea?

@jczic
Copy link
Owner

jczic commented Oct 8, 2018

Hello, root folder is "/flash/www" by default.
You can change it in the constructor of MicroWebSrv.
This is maybe the problem ?

@dukeduck1984
Copy link
Author

Hi,

Thanks for the reply.

So I will need the 'www' folder under flash root even it's empty?

-Kaiyuan

@jczic
Copy link
Owner

jczic commented Oct 9, 2018

Oh no sorry, your problem isn't the root folder.
Just, you must call a function to write the content, see httpResponse.WriteResponseOk() or others in the readme page.

@dukeduck1984
Copy link
Author

Ah! I got you! I should use httpResponse.WriteResponseOk() instead of print(), correct?

Thanks for pointing this out.

-Kaiyuan

1 similar comment
@dukeduck1984
Copy link
Author

Ah! I got you! I should use httpResponse.WriteResponseOk() instead of print(), correct?

Thanks for pointing this out.

-Kaiyuan

@jczic
Copy link
Owner

jczic commented Oct 11, 2018

Yes !

@jczic jczic closed this as completed Oct 11, 2018
@jczic
Copy link
Owner

jczic commented Oct 20, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants