leota / electron-angular4-sqlite3

Sample project to show how to build a desktop app using Electron, Angular 4 and Sqlite3
62 stars 33 forks source link

Is it possible to run it like an angular with ng serve ? #2

Closed JanGr2 closed 6 years ago

JanGr2 commented 6 years ago

Hi. I would like to say thank you as I was trying to integrate sqlite + angular and electron for a few days and without success. I'm not sure if this is an issue as you would find it already or rather this is because I'm new with angular :) . So please excuse me that I'm writing to you in such way. I have just downloaded clear version of your project to see how to use the sqlite with standalone electron app. I wanted to test it from the browser so just stared it as usual Angular application with ng server and then I'm I'm getting following error from index.html

Uncaught ReferenceError: require is not defined
    at localhost/:14

btw. I have no error when running like you advised 'npm run electron'

Also could kindly please advise me how to make it working for inserting the data into the DB ? I mean, how to send any arguments from controller ? Regards Jan

leota commented 6 years ago

Hi, actually this is not an issue but I will help you anyway. First of all, you can't run the project with ng serve and open it in the browser, instead just follow the readme and do:

npm install
npm run db
npm run electron

If you are on windows it will be slightly different (check readme). A window will open up and you can still inspect it as if it was a browser window.

Second, what error are you getting when running npm run electron?

Third, I'm using knex.js to manage DB. You can have a look and learn on how to create new tables and inserting new records -> http://knexjs.org/

Hope this helps!

JanGr2 commented 6 years ago

Hi Thank you very much for you response. Actually, I can run the electron app and check the console without problem. It works without any problem. And I wanted to run it as pure Angular app to develop faster :) With electron I need to restart the app with every code change. This was the only reason :)

Thank you one more time for answer and for working example - this was great hep for me with electron and sqlite.

Regards Jan

On 16 November 2017 at 22:57, leota notifications@github.com wrote:

Hi, actually this is not an issue but I will help you anyway. First of all, you can't run the project with ng serveand open it in the browser, instead just follow the readme and do:

npm install npm run db npm run electron


If you are on windows it will be slightly different (check readme).
A window will open up and you can still inspect it as if it was a browser window.

Second, what error are you getting when running `npm run electron`?

Third, I'm using knex.js to manage DB. You can have a look and learn on how to create new tables and inserting new records -> http://knexjs.org/

Hope this helps!

—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<https://github.com/leota/electron-angular4-sqlite3/issues/2#issuecomment-345075833>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AgKKsYmJz9l4PtwRr1iW-DjdJ1JPSNn6ks5s3K_VgaJpZM4QgZ6b>
.

--

Best regards Jan Góralski j-software.pl

Wiadomość ta jest przeznaczona tylko dla określonych adresatów i może zawierać informacje prawnie chronione. Zakazane jest rozpowszechnianie i przesyłanie informacji do osób nieuprawnionych do ich otrzymania. Zabronione jest także wykorzystywanie tych informacji w celu innym niż zostały przesłane.

leota commented 6 years ago

Oh now I get. Unfortunately this is only possible if you remove all sqlite/electron code.

JanGr2 commented 6 years ago

;)) Thank you anyway

Have a nice sleep

On 16 November 2017 at 23:19, leota notifications@github.com wrote:

Oh now I get. Unfortunately this is only possible if you remove all sqlite/electron code.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/leota/electron-angular4-sqlite3/issues/2#issuecomment-345081237, or mute the thread https://github.com/notifications/unsubscribe-auth/AgKKsZKWLjFnjOKQK9myzmWWMsXus207ks5s3LTngaJpZM4QgZ6b .

--

Best regards Jan Góralski j-software.pl

Wiadomość ta jest przeznaczona tylko dla określonych adresatów i może zawierać informacje prawnie chronione. Zakazane jest rozpowszechnianie i przesyłanie informacji do osób nieuprawnionych do ich otrzymania. Zabronione jest także wykorzystywanie tych informacji w celu innym niż zostały przesłane.