gluon-framework / gluon

A new framework for creating desktop apps from websites, using system installed browsers and NodeJS
https://gluonjs.org
MIT License
3.1k stars 76 forks source link

Using gluon on existing Node.js app #74

Open emirefek opened 1 year ago

emirefek commented 1 year ago

Hi, I was trying to use Gluon on my existing node.js cli application I tried to run gluon like this but when I try that. I get this error. What should I do if I don't wanna gluon as started point of node.js.

https://app.gluon/ HTTP ERROR 404

index.js

import { gluon } from "./glu.js";
const gluon1 = gluon();

glu.js

import * as Gluon from "@gluon-framework/gluon";

export const gluon = async () => {
  const browsers = process.argv.slice(2).filter((x) => !x.startsWith("-"));

  if (browsers.length > 0) {
    // use argv as browsers to use
    for (const forceBrowser of browsers) {
      await Gluon.open("index.html", {
        windowSize: [800, 500],
        forceBrowser,
      });
    }

    return;
  }

  await Gluon.open("index.html", {
    windowSize: [800, 500],
  });
};

Dropped a demo code to try proof of problem. Little edited version of gluworld.