Creating a RESTful api for my Ionic app - javascript

I have created an Ionic app which uses pouchdb to store items locally and then syncs them with remotely with couchdb
I am looking to create a REST api for this app which uses the items stored in my couchdb from the app. A web app will also show all of the items from the mobile ionic app.
I have experience with Node using Express. Would node/express be the best/easiest thing to use when building the api build? Or is there another much simpler more popular way?

You can use Firebase https://firebase.google.com/, it' a mobile platform that helps you quickly develop high-quality apps

If you're not completely set on using NoSQL on your API, you should really take a look at Django Rest Framework.
If you can map your data to objects, I'm sure you can go from zero knowledge to having an API up in hours. The quickstart tutorial is fully functional and you can set that up in just minutes! Plus, having more frameworks and languages under your belt can only be a good thing.

There's a Node client which you can use in your Expresss server for Couch DB called Nano , just like you would use mongoose for dealing with MongoDB . Since CouchDB already provides the ability to retrieve data using http, so you can even use an http wrapper like request but you can use Nano for a higher level abstraction.
You can then go ahead build an API that simply proxies those requests to your CouchDB instance.

Related

Using Axios in Electron - Best Practice?

I am creating an app in Electron using React. The first version will be a purely desktop based app using a local database for data storage etc. However, eventually I would like to utilise as much of the same code base as possible and deploy the same app as a cloud-based alternative (by just leaving out the electron component).
I'd like some advice, thoughts, opinions from the community on if I should use axios for creating internal restAPI infrastructure rather than a API using javascript modules/functions etc. for performing requests such as getting data from a database.
My thinking is then that when I port the application to the cloud, I really just need to change the restAPI locations to point to a cloud version which would then get the data from a cloud database rather than a local database etc.
Would exposing such APIs locally within Electron using axios pose any security risks or other issues that I may need to consider?
Perhaps this answer/discussion may also provide useful for the community in the future.
Looking forward to thoughts, or even new suggestions on how this may be best approached.
Thanks.

node.js as service for mobile + adminisrtation panel with angular

Currently we have mobile app that calls some "APIs" (no backedn yet).
I wonder if it would be ok to use node.js (never used before, I am .net developer) as service (mobile app would call node.js APIs).
And for some dashboard for administrating application, I could try to use angular+node.js.
I have started to learn node.js and angular just a day ago and I wonder if this would work for purpose above.
Yes, you can! Nodejs RESTful API or web services can be used/called by mobile app.
I have developed web-Application & APIs for mobile app on Nodejs, Angularjs, Postgres...
which maintains & used by
Admin Panel
Dashboards
Generating reports (As BI Tools)
Handling thousands of users concurrently & lots more!
Performance is superb! Work like charm
Refer below link, to develop web services for mobile app using nodejs
Designing a RESTful API with Node and Postgres
Basically you want to use the MEAN Stack, check out this blog
https://rclayton.silvrback.com/means-great-but-then-you-grow-up ,
to get the pros and cons regarding the stack usage. You will get rapid development using the stack but need to tradeoff on some features that may be required in the long run.
I just want to say, research before you start your project, because changing the technology afterwards is a huge waste of time and money.

How IBM Filenet Integrated with Angular application

I'm not familiar with Filenet.
I am using IBM FileNet as document management system. How Can I consume Filenet web services Apis in my AngularJs Application.
Please Help me out, if anyone has tried this.
Thanks
Use the FileNet api to develop a class or web service that returns the records from FileNet and then have the Angular app digest the records returned.
See:
http://www.ibm.com/developerworks/data/library/techarticle/dm-0810carpenter/
and
https://www.ibm.com/support/knowledgecenter/SSNW2F_5.2.1/com.ibm.p8.ce.dev.ce.doc/gs_concepts.htm
In very simple terms, FileNet is a just another content Management system.
It has an API that you use to query the backend(Content Engine) for a
documents that matches your criteria.
Each document you get has content(most of the time, a physical file), and properties (In fileNet terms MetaData).
You will need some technology in the middle to translate the data you aquired to a form that is consumable by Angular (JSON). Something that we can call for the moment a Rest Engine.
This "Engine" should help you expose end points (Simple web addresses http:///Path/To/Data) that is attached to java methods that returns the JSONs you made.
To be able to pull that out successfully, you need to have a good grasp of Angular (Services), and then knowledge of one "Rest Engine" (or something you can use similarly, even a servlet would help you for the moment), and finally a very simple knowledge of FileNet basic operations.
A RESTFUL service tier that leverages FileNet EJB API which are much faster than WS APIs (esp. when in a distributed deployed environment) is to be built for this if you are working in an enterprise-level project.

Ionic Framework / .NET application sync?

I want to create a Android application (using Cordova/PhoneGap Ionic Framework, which means it's source code will be JavaScript + HTML + CSS and AngularJS as well. I need that app to sync to a cloud database service, but, I also have a .NET based project, which need to sync to the same database. I wanted to use like a Firebase-ish backend, that could manage all the database stuff, as I wrote only (at least mostly) front-end code for my app. Keeping in mind that I need a NoSQL database service.
To give an example:
I want my app to communicate with, let's say, CouchDB (IrisCouch on the cloud to be specific), and my .NET project to listen to the changes my app makes to the database, and handle them. What I need is a platform where I only need to call API's functions, or the closest I can get to that. I tried Firebase already, but that will get too expensive, as I need something cheaper, at least for now. Am I expecting too much? Do I really need to write server-side code in this case, and if so, which would you guys think it's the best way?
For back-end you can use ASP.NET Web-API which supports ASP.NET Identity with OAuth login like Facebook, Twitter etc. and on front-end you can you use IonicFramework with AngularJs to call those API.
Helpful resources:
ASP.NET
IonicFramework
AngularJS
Restangular (Restful operations made easy for angular)

How can I make my CRUD application work offline?

I have simple CRUD application with the backend written in Flask, datastore is Mongo and frontend in AngularJS.
I would like to augment the application to allow for CRUD operations even when it's offline and automatically sync when a data connection is available. What is the best correct technology to do this with the minimum amount of extra development?
I've looked at Meteor which could solve the problem but would involve re-writting the app in Meteor.
I've also looked at Breeze which look like it might be a better option and allow me to keep using Angular and Flask.
Is it a lot of data? Adding offline capabilities to an existing application will always have some impact.
You could try using some HTML5 features directly: HTML5 Application Caching is made for offline access and allows to download all the needed artifacts for the webapp to be able to work offline, so that solves a part of the problem.
The other part is the the data, it could be loaded into the browser using either the browser HTML5 Local Storage or IndexedDB.
Local Storage allows to store String associated to keys, so for storing JSON you need to stringify it first. IndexedDB supports more data types,both datastores have a Javascript API.
So it would be a matter of choosing one datastore and making a sync module that periodically pings back the server and when the connection is available sync the local datastore.
The alternative is to use some offline first framework like hoodie, this an article from a hoodie developer for how to use hoodie together with angular. He took the Angular TODO sample application and modified it to use hoodie.
This together with application cache might be a lower impact way to get offline capability to your Angular app.

Categories