i am a new flutter dev and I want to understand how to connect a backend of node js to my flutter app. do I set routes and controllers and models like I would normally in a web app?
you can create api endpoint (in server-side) to connect your app with backend
just call api in mobile app with specific parameters.
normal web app usually returns you html page, but you need JSON file only
(sometime you can parse html file to grab data but not prefer).
api that you created (with Node.js/ASP.net/PHP/Python and etc) just return JSON type data and client (mobile app) get data and draw ui or do another operation with it
Related
I'm building a personal project and I'd like to have a REST API that sends JSON. But for the v1 of the app, I'm also planning in using EJS to render the views. Would I run into any issues if I had two routes (one for json and one for views) listening in to the same port?
So far I've started the API so I'm looking ahead to the next few days when I run into this issue. I suppose that if the api routes are 'domain.com/api/whatever' and the view routes are something else 'domain.com/app/whatever' there shouldn't be an issue?
I haven't been able to find a standard solution when you want a REST API and rendered views in the same project.
Is it possible to combine a Vue.js app with a restful API service?
New to Vue but written my first Vue/Typescript app that is a front end that consumes some public APIs, add extra logic and display results. All works – fine. Now I also want to have my own restful API interface.
I know Vue apps are SPAs, so when I ‘change page’ to myapp.com/page2, it is not fetched from the sever but rather the app just re-renders the display. But is it possible for those routes that are not defined, such as myapp.com/api/whatever, to be a restful interface? That is, consumes requests and return responses? And when hoisted, would a user have access to both a front-end and a back-end, even though the app is running client side?
Did start down this route using express.js but ran into issues as if I was trying to combine chalk and cheese. (Not lease, would need to change the node module to ‘commonJs’).
Would using Nuxt help? Know nothing about Nuxt … yet. Or must I go the traditional way, and write a separate back-end and change my front end to consume it.
Currently I'm working project that back-end is based on oracle netsuit erp. I want to create frond-end using angular 2+ framework and host it withing the netsuit server. Is there any solution to that scenario or I just have to use RESTlets and create front-end separately and host it another server?
create your angular SPA as an html file
in that angular app, talk to netsuite using the http client and thru a suitelet, NOT a restlet. this gets you around CORS
upload that file to the cabinet
create the "render" suitelet that will load the HTML file into netsuite's templateRenderer module (ex: var html = angularSrcHtml.renderAsString();)
I have an existing backend with a REST API written using node.js/express.
I can call urls e.g. /getallhouses and get the corresponding JSON object.
Using a mobile app, this is rather straightforward as you just call the REST API and process the data.
As I need to also add a webapp e.g. with React.js, it seems more murky.
What is the best way of implementing this webapp strategy?
Creating a stand-alone react.js app which will be called by the user first and then is using the REST API like a mobile app and hosting that react.js app on a different server?
Or is it better to start from the already existing express/node backend and serving the initial index.html file by
res.sendFile(path.join(__dirname + 'views/index.html'));
and putting all react.js related code into views and letting the backend serving the required react.js app to the user?
The best way is probably that you create a react app with redux and compile it to a bundle with something like webpack. Then you could host your page completely static.
I am creating a Nodejs app with expressjs.
For client side I want to do :
One mobile app (android or ios)
One web app (using navigator like chrome)
For the web app I am using EJS template and it's work fine but now I want to begin Mobile APP.
For this, I created on my server side a REST API which send JSON data.
Is this the best solution ?
Is EJS can use json data instead of passing directly object to the ejs page ?
You can send data to your iOS or Android app any way you want, it doesn't have to be REST... but it makes things a lot easier to understand and manage, both yourself and for others.
Generally, I see no advantage of using templates to serve up json data on a REST interface. You just want to serve out the raw data as is. You can wire it up yourself
app.get('/user',listUsersHandler);
app.get('/user/:user,listOneUserHandler);
etc.
Personally, I got fed up doing that and built my own library https://github.com/deitch/booster for it.
Any decent REST library should serve you up JSON without running it through your EJS templates.
A separate question is if you want to be efficient and run both the Web UI and the mobile app through the same REST API, which means moving towards an SPA/SOFEA/SOUI design, and using Backbone or Angular or similar in the Web UI.