NW.js stuck in loading state after submitting form in Express.js

46 Views Asked by At

I'm looking to use nw.js to make an executable for my express.js app. It's been around 10 days since I've started fiddling around with node.js so please excuse my silly mistakes/phrasings.

The app works fine on browser. There's a form where I input a URL and submit which takes me to the '/getChapters' express route, some processing is done and then the view is updated with the result. But in nw.js, after I click the button, it just keeps loading and loading and loading. I removed all the processing parts and added a res.send("hi") just to see if it even reaches the route but no. Devtools only show client side stuff and there aren't even any errors. So I have no idea what I'm doing wrong.

Here's what I have:

package.json:

"main": "server.js",

index.pug:

form(action='/getChapter' method='POST')
          .input-group
            input.form-control(type='text' name='url' placeholder='Paste the URL of the manga' aria-describedby='basic-addon2')
            .input-group-append
              button.btn.btn-sample(type='submit' style='width:80px !important;')

server.js:

app.get('/', function (req, res) {
    res.render('index.pug', { chap: [], res: 0 })
})

app.post('/getChapter', function (req, res) {
    console.log("hi") //can't even see if this shows 
    res.send("hi") //doesn't show up
});

server.listen(8081, function () {
    console.log("Example app listening at port 8081");
})

nw.Window.open('http://127.0.0.1:8081/', {}, function (win) { });

Node.js: 18.16.0

NW.js SDK: 0.50.0

Express.js: 4.18.2

Please help me out. Thanks in advance.

1

There are 1 best solutions below

0
Jaredcheeda On

This post was resolved by running on Windows 10 instead of Window 7.

Windows 7 support is dying off. For more information about what NW.js versions work with what OS's, check this post: