Can I use Firebase with Squarespace? - javascript

I've built a website from the ground up already but for an upcoming one I need to use Wix or Squarespace as well as Firebase. So I set about trying to figure out if I could mesh those platforms when I came across the answer to this question:
Can I store database information in Squarespace? A: Essentially no
Followed by this documentation from Squarespace FAQs.
I was a bit confused since Firebase uses Javascript to use Auth, Firestore, Functions etc. Even if you need to run server-side code you can make a call to Firebase via JS to run Node applications. So is it possible to use Firebase with Squarespace, if you're allowed to add custom JS to your site?

Yes, Firebase works fully client-side. The only backend code you write in Firebase you can deploy directly to Firebase.
You can follow the official JavaScript web guide for Firebase to get started with this.

Related

Is it possible to run [some] Firebase JS libraries without IndexedDB API?

Some Firebase JS SDK libraries (e.g. firebase-analytics, firebase-remote-config, firebase-performance) seem to require IndexedDB API to initialize. Is it possible to run these libraries and have the IndexedDB API disabled (i.e. for browsers without IndexedDB support)?
I've started to look through the Firebase JS SDK code as well, but wanted to see if anyone has a quick answer.
Cheers

ReactJS vs NodeJS - Why do I need to create both?

I understand that React is frontend, and NodeJS is the backend that allows Javascript code to function outside of a browser. What I don't understand (and this is after following tutorials online on setting up a React project and a NodeJS project) is why I have to create an instance of each.
For example, in my React project, I managed to create a website. But because I needed a backend, I decided to use NodeJS. But I'm doing NodeJS tutorials, and I can create a website using NodeJS too. I'm confused because right now, it's appearing to be that React and NodeJS do the SAME THING.
I have never worked with NodeJS before so I am a bit confused. I was under the impression that I would just use NodeJS to host the backend, but after seeing that I'm literally having to create an entire website with NodeJS, I don't understand how I'm supposed to use React and NodeJS together.
How do the two, React and NodeJS, integrate together to create a fully-functioning web app? I have yet to see something online that clearly breaks down how the two interact.
React is front-end library. It provides great tooling for creatiing user interfaces. And it creates a single page application. Which means when you open a react app. It does not reload and its really fast.
While you could also use nodejs and something like handlebars to create a website. But that website would be rendered on server and then served to the user. But its alot more than that. There are a lot of things that you want to do on the server. Like authentication. You want that part to be secure. So you keep it on the server.
Now the answer to the final part of your question.
For a fully functional app. You would use react to create user interfaces. And nodejs for creating an API which your react app will call.
NodeJS is not just regular javascript, it is a javascript runtime that sits on top of a C++ engine called V8, provided by Google. Node executes outside the browser, whereas React / Vue / Angular / etc are in-browser javascript frameworks.
React is a whole separate animal; it is a framework that renders its own DOM in the browser. It is a javascript engine that is configured to optimize DOM manipulation.
While the development pattern of frontend and backend appear similar, they are doing different things. React is handling component lifecycles, applying dynamic style rules, processing in-browser data, and making API calls. Node is handling requests from the browser, coordinating access to the server's file system, managing network I-O, performing cryptographic evaluation, etc. Because of these different responsibilities, Node makes use of different dependencies (read: node modules) than a frontend framework.
Ultimately, Node and React communicate through HTTP calls (or, less frequently, through a WebSocket or SOAP protocol).
It would behoove you to read about how node works under the hood.
NodeJS is just a runtime that allows you to run javascript code outside of the browser.
In order to compile and transpile the react JS app, they use webpack and other tools which runs over NodeJS.
NodeJS will serve as your backend, whereas ReactJS will create the interface/UI where you can actually manipulate your server (nodeJS). So first you'll write your NodeJS server or API. You don't need to use ReactJS to create a frontend that would interact with your node server, like you said you can use NodeJS to create your views as well through a different library. ReactJS is just one choice of many for the front end of your NodeJS app.
The point is that react and any other SPA library is working on a client-side (browser).
React fetch and consume the data from the server API.
You don't need to use Node.js for building API. You can use various frameworks based on the technology you prefer.
If you are not familiar with the Back End, you can use https://www.npmjs.com/package/http-server to have a fake API service and can build the Front End part with it.
NodeJS is a javascript framework that allows you to create a server to serve up websites using Express or the built in libraries. It also is capable of building a website with just NodeJS.
You can take advantage of the ability to do server side rendering with a NodeJS server.
https://reactjs.org/docs/react-dom-server.html
There is a ReactJS framework called NextJS tha has server side rendering of ReactJS component.
https://nextjs.org/#features
You could potentially have some areas of your website that are built solely with NodeJS and other pages that use ReactJS and a NodeJS backend. But it is cleaner to use ReactJS for the front-end and NodeJS for the backend.

Adding api.ai chatbot to my Meteor.js chat application

I have a Meteor.js app similar to this one -> https://www.youtube.com/watch?v=66DH69e-wJ0&t=936s as my first Meteor.js app.
And I have created a API.ai chatbot.
And now I need some guildlines of what should I learn/read to achieve something like this:
I want a function to send user messages to the api and then posts
api's answer into the chat.
It's hard to answer your question if we don't know any details, but I would suggest to read carefully Meteor tutorial. Depending on frontend library you use:
Meteor tutorial for Blaze
Meteor tutorial for Angular
Meteor tutorial for React
If you would like to use other libraries the best place to start is the GitHub repository with Meteor integration for this library. For example Vue.
Secondly, you should read Meteor guide. You will find here tons of useful tips.
I took a quick look at the video you included and API.ai. I guess that you will need this node package. Also, take a closer look at Methods section in Meteor guide. You will need them to use API.ai package from your client side. When you work with third-party APIs you should also read about HTTP package.

Firebase is not defined

I'm a newbie with firebase and want to set up a simple login module for a website. I set up a page with a form and two fields:
1. Mailaddress
2. Password
When the login is authenticated I like to direct to a another page.
I have two questions:
Question 1.: When I look in my source code I see the error message: "Uncaught ReferenceError: Firebase is not defined"
I checked the url in my dashboard of Firebase and it is correct. Is there something I am doing wrong.
Quesion 2.: I have looked for a login exmple with firebase, but I only could find an example build with the old deprecated version of Firebase (which I am trying to use in my example).
Hope somebody can give me some leads or tips. Would be very gratefull.
Thnks!
Kenneth
As Marein remarked in his comment, don't waste your time trying to learn about a platform on an older version. It's simply not worth the hassle and it'll be almost drastically reduce our ability to help you.
That said:
You're only including the simple-login script, which used to be separate from Firebase's regular JavaScript SDK. So the error message signals that you also have to include the regular SDK. For today's Firebase, if you go to the front page of Firebase's documentation for the JavaScript SDK, you'll find that the JavaScript SDK can be found at https://cdn.firebase.com/js/client/2.2.4/firebase.js. This latest SDK includes both the core Firebase functionality and the login functionality. So if you just replace your current included script with this one, you'll be good to go
Now that you've included the current version, you can find example of authentication on this page: https://www.firebase.com/docs/web/guide/user-auth.html

Difference between Datastore and Core APIs when just storing files in Dropbox?

I'm about to connect a browser-based JS app to Dropbox. I was about to settle with dropbox-js when something caught my eye in the blog post Writing a file with the Dropbox JavaScript SDK:
As a side note, I'm using the Datastore SDK here. You could instead use dropbox.js from GitHub instead. The Datastore SDK includes the same file functionality.
This is weird. First of all, dropbox-js is the only project in the Github organization "Dropbox" that is marked "unofficial." The project isn't exactly beaming with activity (last release was 7 months ago, some of open issues have been opened by the original author 2 years ago).
The Datastore SDK, on the other hand, is well documented (but closed source?).
So, given that I want to just read/write files from Javascript, what SDK should I use and why? Is there a difference between Datastore and Core API?
The big difference is that the Datastore SDK includes "datastores" (a means of syncing structured data with automatic conflict resolution).
The file portion of the Datastore SDK should pretty much be identical to dropbox.js, since it's a fork.

Categories