I am trying to develop an application using node.js.
Since the same application can be accessed from a mobile device sometime later, it is expected that the APIs will return the json data, and not forward the request to a page after setting the appropriate request parameters.
I am mostly a Java backend guy and a newbie in the UI frameworks(including javascript with just basic knowledge).
I was wondering which UI technologies should i use for the UI? Should i go for plain HTML or php or anything else? Also, will the other UI Application be a webapp and deployed probably in a web server?
Started to use the express module for node.js, and it is awesome. It provides jade(and from which the basic UI can be created very easily) but i have not had the chance to see much into it. Also if i start to use jade, i guess in my app.js file, i will need to forward the request to a page, and not return json data, which i want to avoid.
Can someone suggest me which UI technologies should be the way to go?
The UI is supposed to be quite rich, and with lots of functionalities.
Thanks
Tuco
I would definitely recommend using express.js. As you mentioned you can render jade templates and this will display to the user as html.
You can also send plane old JSON data to the client by using the res.json() method made available with express.
Backbone is a client side framework where you can make single page web applications, and all the html templates are rendered on the clients machine rather than on the web server. Data is persisted to a backend database by using a RESTful API and the following ajax requests. GET, POST, PUT and DELETE.
Later down the line you can use this RESTful API for your mobile app.
Related
I created a restful web-app platform using yii2 framework. It is working with no problems using a browser. Now I'm developing a mobile-app with angular and ionic and I'm searching for some guide to help me splitting the request from browser and app. Using the browser the web-app is configured to have a html view response, how can I detect a mobile-app request to change response in JSON format in each controller/action?
It's my first mobile-app development.
I just fighted this same war this week and I ended up splitting the folders and generating a new yii-app with fresh controllers just for the api.
I tried creating the api folder inside the web backend project, but I had to much problems with redirections, and as I was working from Android emulator fueled by Expo it was almost impossible to reach the api inside my localhost from outside.
At the end in the API REST you just reuse the database connection, rest of files are new. So there is no much to win in placing it in the same folder/project.
By the way, read this documentation: Implementing RESTful Web Service APIs in Yii2
As a code example you could check my yii2 web app: https://github.com/jvidalv/fempoble
And the api that works with the web: https://github.com/jvidalv/api-fempoble
I have a web app developed using..(PHP,MYSQL,HTML,CSS,JS,AJAX,Datatables, bootstrapjs)
Now, I want to make a desktop version of the same app, and I came across electronjs.
The problem is I dont know whether ELECTRONJS will support all my requirements.
A breif of my requirements:
My app is responsive using datatables.net library including EDITOR for displaying the data .
the datatable plugin requires ajax calls to some API (Which I developed with PHP and hosted on a server)..
but now I want to even do all the DB Operations with electronjs so that my app can work offline.
I am not sure if I can do that with electron
- calling an API (created by same app) from HTML/frontJS
- the API Returns Json data
- the Front JS displays that data on front.
Kindly let me know if this can be done with electronjs,
Well, basically yes. You can build a desktop app like this.
But you wont be able to run it offline if it depends on a server sided API. If you can rewrite your backend Code in JavaScript and use a SQLite DB instead of a MySQL you can run this as electron App.
Keep in mind that your business logic in the frontend can always be abused because it’s not hidden from the user.
FYI: Electron only runs a browser inside it’s own App container. So there is actually no crucial difference between Browser or electron App.
I'm building a mobile web-app through the framework Ionic. In my app I want to get data from an API and it seems like the API does only support requests in PHP (or some server side language). Thus it does not support CORS or JSONP which I am used to making requests to through AngularJS.
How can I communicate with this API in my app? Do I have to set up some kind of API proxy or what is the most usual way to go here? Seems like a quite common problem but I got really confused when searching.. node-modules, browserify, proxies.
It is possible but you need a server in the middle that uses CORS or JSONP to serve the content of the API that can be read by javascript, or you need to load the page in the ugly way using an iframe and than get the content from the iframe (if you can communicate through get requests).
I am very new to web development, and i am trying to understand the structure for the flow for a html5 app using jquery mobile, to see whether i am doing Cross-origin resource sharing or not. I am basically just writing an app in html5, then going to package it in phonegap. I am hosting some php on a remote server and those php will make calls to the database and return the data through Ajax calls back to the app.
There is no error called if i run everything on my browser now, but if i package it with phonegap. Is that still going to be ok?
I'm converting my Play 2 application to a SPA and I'm trying to figure out how to still use SecureSocial for authentication.
I'm removing all the HTML templates (except the ones used by SecureSocial to send emails) and modifying my controllers to only provide JSON responses.
Is it possible to prevent SecureSocial from rendering HTML and let my application exchange authentication data in JSON format? Is there any example or tutorial that explains this topic? I've been googling for a few days now and unable to find any useful or at least understandable information for a newbie like me.
Latest changes in master made SecureSocial more friendly with mobile and SPA apps. You can now use the LoginApi controller to authenticate a user using the UsernamePasswordProvider or any of the OAuth2 based providers.