Fetch Firebase data from app to website? - firebase

I have built an iphone app that writes data to firebase. That works fine. Now I want to display that data on a website. I am totally new to programming, and had to learn swift from scratch.
So my question is; is there a easy way to display the data on the webpage? It dont have to look good as long as the data is displayed. I'm not sure if I'm able to learn another codelanguage just yet ☺

To build a web site you'd use a combination of HTML (for the layout of the web site), CSS (for the actual look of the web site) and JavaScript (for the logic of the web site). JavaScript is indeed a different language, but a second language should be easier than your first one.
I recommend studying the Firebase Database documentation for JavaScript and taking the Firebase codelab for web. They are the best ways to get started with Firebase.

You may use the Firebase JS SDK
https://firebase.google.com/docs/database/web/start
use Nodejs to generate static HTML
or
use Express as the website framework, dynamically generate the pages

Related

Generate site when headless cms modifies database

I've been reading about how nuxt can generate a static site when a client makes a request to view the website. We are planning to build a headless cms to migrate the database with the data the website needs. This data will only be changed when you save it in the headless cms.
My question is since this data will only change when it is changed in the headless cms. Isn't it possible to just generate the site when it is modified from the headless cms, and then serve that site to the client? To reduce server costs.
Is it possible to do this with nuxt? Or are there any possibilities to do this?
We are planning on using Firebase as a backend.
There's nothing explicitly preventing Nuxt from being rebuilt each time you change an item in your DB. The part that matters is how you tell your app to rebuild itself.
By far the simplest way is using some sort of "build hook". See Netlifys docs here for a quick overview of what they are. However, this only really works if you're using a headless CMS that can send hooks on save, and a build provider that can trigger builds using those hooks.
You will absolutely save on server costs using this sort of method, but beware: if you have a lot of user generated content triggering builds, your build cost can easily outweigh the server costs. You also need to be aware that builds generally take a few minutes, so you won't see instant changes on your site.
The other option you have is foregoing static site generation in favour of SSR, which can dynamically load and render your content, completely avoiding the need to build every time a new DB change is made. This is what I'd consider the best alternative if you do indeed have a lot of user generated content.
It's hard to give any further advice without knowing the specifics of the CMS or build provider though.

Do I still need a backend like RoR or Django if I use Firebase?

I am a Front-end developer with limited backend knowledge.
My question is do I need other backend frameworks like Django or Ruby on Rails if I use Firebase as a backend? In other words, can I solely depend on Firebase as a backend and build a single page web application or Mobile application without writing a single line of backend code?
Thanks for your time viewing the question.
I was also looking for a platform to minimize server code and I found that firebase can help a lot.
You will get plenty of docs on net. You can start at angular fire + firebase doc
https://www.firebase.com/docs/web/libraries/angular/quickstart.html
Following document was helpful for me to design my app, which requires some amount of off-line processing too.
https://firebase.googleblog.com/2013/03/where-does-firebase-fit-in-your-app.html

Getting started with databases

I am currently a front end developer. I know HTML and CSS pretty well, I'm OK with jQuery and know some Vanilla JS. I have an idea for a website I want to create where I will be storing data for products (data that I will be grabbing from various websites around the web). It's basically a help me choose application where the user will go through some steps and be given some choices based on their selections. This site is nothing new, but it's more for learning purposes/portfolio work.
Most of my co-workers use ASP.NET and I've seen that you can setup a website like this using ASP.NET and the provided server controls along with C#, however, I want to take another route that allows me to do the same thing NOT using ASP.NET (C# is OK and preferred if that is possible) in that I can grab data, store data, and bind data to my page.
In addition to this, I would like to do this on the Mac.
Here's a list of things I have looked at:
MongoDB (I was really confused by the setup and didn't read anywhere that this would definitely be the solution).
AngularJS
EmberJS
BackboneJS
Several other JS frameworks
Ruby on Rails
Note about the above: Some of the above might be the solution, but I don't want to start spending time learning them only to realize a week in that this is not going to help me get to my goal.
If this post would be better suited for another stack site please let me know. Thank you.
To create a basic website with a persistence you'll need to deal with three parts the front-end (client), back-end (server) and the persistence (database). Of the things that you've listed Angular, Ember and Backbone are all front-end frameworks. They each have their own way of approaching the issue but they all work in the client facing part of the project so views, interaction and dispatching data to the backend. Rails is the only thing that you've listed that's a back-end framework, another option for the back-end if you're more familiar with JS might be Node and Express. Node allows you to build a server in JS and Express is one of the more popular Node frameworks. That section will be responsible for getting the calls for data and calls with data from the front-end and dispatching the appropriate response. Rails typically works with with a SQL database like MySQL or PostGres out of the box because Rails' active record is meant to work with SQL. Mongo is a NoSQL database and I think people are getting it working with Rails but I don't know that it's highly common. Mongo's shell is pretty much javascript and it stores data as JSON (not technically but close enough) so it's been a comfortable choice for JS developers learning back-end. Either Rails or Node can get a server up and running locally on your machine so you can work with the full architecture. So what it comes down to really is picking one of each from those sections and making them play nicely together. For your purposes I would think that the way to go would be either a basic Rails app (probably with MySQL) and using jQuery ajax calls to manage some calls from the front-end or building something with the so-called MEAN stack (Mongo, Express, Angular, Node) which is all JS and using Angulars built in http functionality to handle those calls. Hope this at least narrowed the field of research a bit. Really thats a pretty open question and there are a lot of options.
What is your webhosting site? I suggestPhpmyadmin Or Mysqldatabase You can create tables and strings where you can put the websites you wanna "grab" data from and put a little javascript in there to tell your website if blahblahnlah =blahblahblah then get id="website1"
Some clarifications:
At first, you need to distinguish between a server side language (used to program the functionality) and a database (used to store data).
C# is a language of the .net framework. Regarding websites, there's no C# without ASP.net.
There are two major groups for realizing back end solutions: PHP (market share ~ 40%) and ASP (~ 25%). PHP is a programming language, ASP.net incorporates several programming languages (mainly C# and VB.net).
Both worlds are able to connect to databases: For PHP, this is mainly MySQL, for ASP.net it is mostly Microsoft SQL server.

Build an App for a Wordpress site. Is PhoneGap the solution?

I have a few Wordpress sites and I would like to create apps (IOS and Android) for all of them. I did some research and found that PhoneGap (or similar products) appears to be the solution.
The App will simply get information from existing Wordpress site. I do not plan to add login/edit/post features to the app at this time. My sites have both Pages and Posts. Does that matter?
Is there any better solution than PhoneGap?
Thanks.
The two current big multi-platform solutions for apps are PhoneGap and Titanium. PhoneGap is less work, but Titanium has better performance and uses the platform default UI. Since you aren't building an advanced app, just reading JSON feeds, PhoneGap should work great for you.
It does not matter that you have both pages and posts. You will need to use a JSON API in order to get the data from WordPress. There are a couple plugins that do this and they are working on adding a JSON api to core right now. Until the core API is done, I would recommend using the WordPress.com JSON API that's included with the JetPack plugin since its made by Automattic and it has great documentation. If you go this route, you can also fairly easily add login/editing/posting later on with OAUTH2.
You should also check out Steroids.js, which builds on top of PhoneGap and adds features like real-time updates to devices without compiling, native UI elements etc.

Create a Phone Application base on an Asp webApplication

I have to develop a phone application on every platform so I thought of using phonegap. Seems pretty nice.
I have a web application coded in classic Asp and it's this webApplication that I need to strip down to be a phone app.
At first I thought it will be simple, my classic Asp render some html so phonegap is able to put it as an app.
But it's not that simple, because in my asp I have some code that is rendered server side, I've talked to some who tell me that some html could call the asp pages and this html could be used in phonegap. Don't think it's possible ...
Well if someone could help me here, maybe i've said something wrong in my little text don't hesitate to correct me :)
My solution (I think) : code some webServices in asp.net that will use the same database as my asp classic web application. And some html and jquery will call the webservices and those html and jquery will go trough phoneGap
What is the best way to transfer and asp classic web app to a multiplatform phone app ?
EDIT : After looking everywhere, effectively phonegap can't use asp pages. So I'm questionning myself should I do a mobile website or a mobile app with webservices?
EDIT 2: I'm going for an asp.net mobile website, someone have a great way to do this, I've seen the answer proposing mvc... more details?
You are on the correct path in wanting to use PhoneGap to create a multi-platform phone app via HTML5, and some mobile framework like jQuery Mobile.
Yes, you can leverage the power of ASP.NET to serve up your data but I wouldn't create an asmx web service. A SOAP-based service serving up XML may be too fat/overkill for your mobile web app. Instead, you may want to investigate using JSON which is more lightweight (remember, bandwidth is a concern with mobile apps). One can rapidly create an API to serve up your JSON data via the new ASP.NET Web API. With your API exposed, you can make an ajax call from your html page to retrieve the JSON and bind it using jQuery.
The bonus to using the ASP.NET Web API would be when it's time to upgrade that classic ASP web site you have there, you could leverage the API you already created.
I'd really consider rewriting the website using Mvc.Net. You may want to consider using the iUI for the views.
It will be much cheaper long-term to use modern technology than trying to shoe-horn legacy code into new usage areas.
It looks like you've made up your mind to go with a webapp instead of native apps via PhoneGap. I would recommend that you pick up this book by Jonathan Stark. It's very short - shorter than it should be when it gets into using PhoneGap - and although it focuses on iPhone development, much of the content is applicable to most mobile devices. The first few chapters give a great introduction on developing attractive, responsive, highly usable web apps for mobile devices. If you familiarize yourself with jQuery and jQTouch you can get some really great looking apps with relatively little effort, regardless of the server side technology you go with.
So i'm questionning myself should I do a mobile website or a mobile app with webservices ?
The answer to that question is always mobile website... given an outdated website that the client is wanting duplicate functionality in an app.
Do the work to convert the website or at least the portions that you need to use ajax and webservices. Once you have that in place pulling the same data to place in a mobile app will be easy... you've already done it once.
So my approach would be to convert this dataview into two separate elements Data and View.
You can probably even keep the current asp pages without a lot of modification to the code since you can still call these web-service functions the same way as before in your asp code.
Well, if you really want to reuse your existing webpage you can do the following.
Create a index.html and the body.onload event, redirect to your webpage.
Then build this index.html with phonegapbuild, and you will get your "native" application that simply loads your existing webpage.
If you want to serve mobile users, you have 2 main options:
Create a mobile website. You can render html on the server all you want, no javascript programming needed. Maybe look into jQuery mobile, it can be a cheap and easy way to make the website better for mobile users.
Create a html web app (and package it inside PhoneGap if you want). This is basically a html page which loads just the data from the server in json format and updates the page contents dynamically with javascript. You need good js skills to implement this, you're server is just a REST api that server json - technology can be anything, at least asp.net mvc makes it easy. On the client side you'll want to use some good structuring frameworks, backbone.js ( http://documentcloud.github.com/backbone/ ) is a good option. Check out http://m.linkedin.com for an example of what a mobile web app can be.
3rd hidden option: just create a native app for each platform, that'll get you the best user experience.

Resources