Ccortina
Ccortina

Reputation: 587

How to make Node Webkit work with express generator

im trying to make an App with Node and Express using express generator and packing everything with node-webkit. express generator creates an extremely basic app , but it works running npm start on localhost:30000.

the manifest

{
  "name": "app",
  "version": "0.0.0",
  "private": true,
  "node-main": "./app.js",
  "main": "http://localhost:8080",
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.15.1",
    "bower": "^1.7.9",
    "cookie-parser": "~1.4.3",
    "debug": "~2.2.0",
    "express": "~4.13.4",
    "morgan": "~1.7.0",
    "pug": "^2.0.0-beta4",
    "serve-favicon": "~2.3.0"
  }
}

the folder structure Folder strcture

When i run the app with nwjs the window displays that the page can not be loaded, but the console doesn't show any error. I tried changing

"main": "http://localhost:8080" to "main": "http://localhost:3000"

which is how the app runs usually, but it didnt work either.

enter image description here

is this possible? what am i missing?

thanks in advance

Upvotes: 1

Views: 767

Answers (1)

Cell
Cell

Reputation: 193

This can be a bit late, but anyway. Here is the source: https://github.com/nwjs/nw.js/wiki/NW.js-use-express-and-similar-web-frameworks

node-main should have path to file, which sets up the server. In this case I assume it is located in bin directory and is named www. Therefore, the package.json should be like:

{
 ...
 "node-main": "./bin/www",
 "main": "http://localhost:3000",
 ...
}

Also check the port number if it is 3000 or something else.

Upvotes: 1

Related Questions