• tomgrz
    tomgrz
    2020-12-17

    Cool! I have to try-out these tools sometime. I've always been deep in the back-end and do not have much experience with the front.

  • Sophos
    Sophos
    2020-12-17

    I would like to suggest a more structured approach here:
    - https://www.guru99.com/web-application-testing.html

    or more general:
    - https://martinfowler.com/articles/practical-test-pyramid.html

    or from first principles:
    1 - Think about who is going to use your site and for what.
    2 - Define user stories around the desired behavior of the site. Preferably using the AS... WHEN... THEN syntax.
    3 - Design your test suite to exhaust your most important user stories. This will be your functionality test suite for further development.
    4 - Add unit and integration tests as development progresses
    5 - profit!

  • Hans W
    Hans W
    2020-12-17

    In a webserver you can normally configure settings so dirlistings are not available and also a default page can be set.

    https://www.simplified.guide/apache/disable-directory-listing

    Default file:

    DirectoryIndex landing.html index.html

    I am sure there are other sites that explain how to do that on nginx too

  • TDB Gryffyn
    TDB Gryffyn
    2020-12-17

    So, when you use file: as the protocol, you're telling it to use the local file system. Because of that, you have to point to specific files. Just using /public/ points it to a directory so yeah, getting a list of files in that directory makes sense.

    When you go through a web server like Apache or whatever, there's a config option for "what is the default file to serve if no file is specified". Generally that default is index.html but you can usually specify more than one, so it might be like index.html, index.php so if index.html isn't available, it'll look for index.php before defaulting to displaying the directory contents (if allowed by configuration... either main Apache/et al configuration or .htaccess directive saying whether it's cool to list the contents of the directory. And when I say "go through a web server", that involves server software listening on a specific port and processing requests. http is typically port 80, https is typically port 443. So to "go through a web server" and still be running things locally, you'd likely use http://localhost/ and the default root directory would be set to to your /public/ The nice thing is that PHP and I think Python have built in webservers for basic functionality.

    Let me know if you have additional questions.

  • cybertron
    cybertron
    2020-12-17

    IRC -> Freenode -> #python

    Can, probably help you...

  • Sunyata ☸ 👨🏻‍💻 ☮
    Sunyata ☸ 👨🏻‍💻 ☮
    2020-12-18

    Thank you everyone for your help! I'm new to web development so all of this is good info for me to have


    PS: I have come across the http.server module which is built into Python: https://docs.python.org/3/library/http.server.html (I've yet to try it out)

  • TDB Gryffyn
    TDB Gryffyn
    2020-12-18

    Yeah... so that's a bit more of the internal technical hows and whys.. but info I was talking about is in there, but this page is a simpler rundown:
    https://developer.mozilla.org/en-US/docs/Learn/Common_questions/set_up_a_local_testing_server

    The simplest version is just this:
    python -m http.server 8000

    (depending on your install, see the notes about using "python3" or other variants instead of just "python")

    This tells python to start an instance of http.server listening on port 8000.

    From the same machine, you'd use http://localhost:8000 to access that web server.

    Looks like it defaults to the directory that you were in when you ran the python -m command, so cd to that directory before running it.

    If you're just working with .html files, you don't really need the web server, you can keep using the file:// protocol