Implementing a server in ionic

I want to use node.js in ionic but I don’t know if I do it in the same folders and documents of the app that I’m developing or I do it separate from the app?

Can you back up a bit and describe your actual goal? Webservers on mobile devices don’t generally make a lot of sense.

I’m doing an app that is going to request information from the database and show it, also capable to send information to the database and it will stored that information and my question is that if I need a server to request the data base and if I need it, do i do it in the same app or in a separate?

No. You would generally just use Ionic Storage if you can, and SQLite otherwise. No webservers unless they are going to be hosted somewhere apart from where the app is running.

Do you need NodeJS to talk to the database? This question became more important recently, because Angular 6 fully decoupled from NodeJS. So if you want to use Node libraries, you need to make sure they are included in your build process. Personally, I love the Node 8 promisify function, so I’ve included Node’s util library just for that. I’ve also used the Node Timer object in Ionic code. But I’ve never used anything in fs. To talk to a remote database, I use Angular’s HttpClient, or a specialized library, like angularfire.

1 Like

Where is the database? If it is remote, are you asking if you can create a remote server with Ionic?

two types of storage:

  1. locally inside ur app
  2. remotely for fetching data for app

for 1st type, use Ionic storage or SQLite, suggested by rapropos above.
for 2nd type use any database in ur server. u can use any server. php, nodejs, or any as u wish. create api in ur server for connecting database and ur app. use api in ur app for fetching data.

1 Like

I got one more question because when you stored the information in the app, when you close the app and you opened again any changes that I did to the storage I will not be there what I need to do to keep any change that I do to the storage information each time that I run the app?
Thank you

Read about SQLite first. Another way is keychain storage for ios app.