• New to Javascript questions

    From Vonskie@SHAKEYVW to ALL on Saturday, August 10, 2019 21:53:35
    How would you debug an index.xjs file

    I have vscode for linux loaded it does not know what that file type is

    I know you can use notepad mousepad etc to edit the file and the load the webpage but there must be a better way?

    So you can step thru code and watch variables etc.






    * Shakeybbs.com * (Allen, Tx) HTTP-HTTPS-WS-WSS-SSH-Telnet-FTP-POP3 [Dove-Net, FidoNet,FDN Echo File] (10 Nodes hosted on a PI4)

    ---
    ■ Synchronet ■ Shakey BBS
  • From echicken@ECBBS to Vonskie on Sunday, August 11, 2019 03:03:23
    Re: New to Javascript questions
    By: Vonskie to ALL on Sat Aug 10 2019 21:53:35

    How would you debug an index.xjs file

    I would look at the error message(s) being generated and then address them by fixing the embedded SSJS.
    Or if there are no errors, I'd examine the script(s) until I found the cause of whatever bug I was trying
    to find.

    I have vscode for linux loaded it does not know what that file type is

    XJS is unique to Synchronet. It's HTML with embedded server-side javascript. VS Code wouldn't know what
    it was unless someone wrote a plug-in / extension to handle it, and I'm 99.99999% certain that hasn't
    been done. I almost started on one a month or two ago but it seemed like a lot of hassle for something I
    haven't needed thus far.

    I know you can use notepad mousepad etc to edit the file and the load the webpage but there must be a better way?

    "There must be a better way" is a big assumption. There are a lot of things about the nature of
    Synchronet that make such assumptions unsafe. We can dig into that further if you really want to know
    more.

    So you can step thru code and watch variables etc.

    As far as I know, we don't have a debug tool for JS available that'll do what you're describing. (I
    think jsexec has a step debugger, but that won't help you with the webserver.)

    Normally if I can't figure something out just by reading the relevant scripts and error messages, I start
    inserting log() or write() statements in relevant places so I can examine the state of things at various
    stages. It's ugly, but it works.

    ---
    echicken
    electronic chicken bbs - bbs.electronicchicken.com
    ■ Synchronet ■ electronic chicken bbs - bbs.electronicchicken.com
  • From Vonskie@SHAKEYVW to echicken on Sunday, August 11, 2019 21:09:02
    Thank you very much for your answers


    * Shakeybbs.com * (Allen, Tx) HTTP-HTTPS-WS-WSS-SSH-Telnet-FTP-POP3 [Dove-Net, FidoNet,FDN Echo File] (10 Nodes hosted on a PI4)

    ---
    ■ Synchronet ■ Shakey BBS