How to use MongoDB in a vanillaJS project - no-framework

I want to implement a CRUD mongoDB functionality into my web app witch only has HTML,CSS and vanilla JS.

You can't , but more important is that you shouldn't.
MongoDB is a server database and you should connect to it with some kind of backend. So, you need to use something like Java, PHP, Node, etc. to connect to MongoDB. The right way to do this is to build some API that you can consume using JS (like a REST endpoint).
Even if you could find a way to connect to MongoDB using JS, you would be exposing YOUR WHOLE DATABASE to anyone who has a web browser and access to the URL. Also, if you want it to be accesible from anywhere, you would need to allow ANY IP address to connect to the server. DON'T EVER DO THAT. DON'T YOU EVER EXPOSE YOUR WHOLE DATABASE TO THE INTERNET

Related

How i can share data which i connected with Heroku connect with other salesforce users

I have my website in PHP and DB in MySQL. I want salesforce users to search on my database from within their salesforce. For that, heroku connect seems to be the option. So i am thinking of converting my MySQL DB to PostGre and then use heroku connect to share my data with my salesforce account. The question i have is, how can i share same data with other salesforce users ? Those users are my website clients and i don't want them to go through this process of heroku connect. Is there was of sharing my data with other salesforce users ?
You cannot and should not expose your database directly to your customers. That would allow them to change the data as well as read it.
Your solution here is to create a public API which exposes endpoints that will make it possible for anyone (with proper authentication hopefully) to query your data.
There are many ways you can design an API, whether it's a REST or a GraphQL one. This is something which can absolutely be done in PHP though.

Oracle jet connection with Oracle database without using REST API simple example

I am able to connect to an Oracle database using the REST API, but I want to connect to it without the REST API. Is there any another way to connect to an Oracle database?
The short answer, No.
Oracle JET is a pure client-side toolkit. It does not run or process on the server. Because of that, the only interaction with data resources is via Web Services of some kind. REST is the most common. You could use WebSocket, or Server Sent Events as well, or some other method that a pure client could communicate with.
Do you want to get rid of creating a REST API endpoint in your middleware by hand?
If the answer is yes, then you could use this: http://www.oracle.com/technetwork/developer-tools/rest-data-services/overview/index.html
If the answer is no, then sorry, no. Practically, that is the only way to fetch data from the server.

is rethinkdb horizon well suited for a rest api web service?

I see that rethinkdb now has an app server called horizon and it's examples include a lot of client apps without any backend server code.
If I wanted to create a REST api service with rethinkdb - does horizon still add value or should I just create a standard node.js rest api using rethinkdb libraries directly?
I see that horizon has some authentication, authorization and permissions built in which could be useful but I'm not sure if turning it into an api instead of a standard web app is making horizon bend into something it's not supposed to be.
If I wanted to create a REST api service with rethinkdb - does horizon
still add value
No, if all you want is a REST API endpoint mapping CRUD operations onto your RethinkDB data, then Horizon won't help you there.
Horizon is great if you want websocket API w/ "real-time" features and plan to use the Horizon client in the browser.
Horizon is opinionated in how it handles users and permissions (it enforces them on the server side using different users/permissions for each app instead of the RethinkDB users table).
# RethinkDB
r.db('rethinkdb').table('users')
r.db('rethinkdb').table('permissions')
# Horizon
r.db('myapp_internal').table('users')
r.db('myapp_internal').table('users_auth')
I'm currently playing around with a stack that uses feathers to design common services that can be exposed over a REST or websocket transport. Its more complex, but I might use both feathers and Horizon, but there will be some work to map permissions correctly across both endpoints. (Plus schema enforcement...) Feathers supports various authentication providers that return JWT which you could then pass to horizon (if you set the same secret_key)...
If you don't need the real-time features in your database, you might want to check out PostgREST as it has out of the box JWT authentication and uses actual database roles for row level authorization. "One source of truth". You could use that together with PostGraphQL if you want both REST and GraphQL! Plus you can store JSON data in columns these days so its all good!
So many options!
Good luck!
You can embed Horizon in a node app and only use a subset of its features: http://horizon.io/docs/embed/ . You should be able to piggyback on the authentication pretty easily. It would be harder to piggyback on the permissions if you're implementing your own REST API, because the permissions system only controls access to collections.
Personally I suspect it will be more trouble than it's worth if you're embedding it just for the authentication.

Cloud / server side code with Apigee or Usergrid

Is it possible to execute server side code (something like Parse "Cloud Code") with Apigee, as backend for a mobile app as client?
I'd want to use the out of the box "App Services" functionality, but perform some extra stuff (like updating data) from the server side,
The only (naive?) way I can think of is this:
Have my own server running.
The mobile app uses standard "App Services" API on Apigee
If necessary, the client calls
some custom API on my server,
which lets my server call Apigee via REST to fetch data, calculate some results, and post the updated data Apigee
and then returns the result to the client
Sounds a bit complicated (especially in terms of handling authentication) - are there any best practices to achieve something like I described?
Thanks!
Consider App Services as your database in the cloud to which you can talk using APIs. Therefore, you really don't need that server in the between unless you are doing some heavy lifting in it. You could make that API call directly from the app.
Even if you want to have a back end server for your app, you can leverage the node.js functionality that Apigee Edge provides and have a server up and running in the cloud in quick time. More info can be found here
If you want to do server side validation, you should use a Node.js proxy that incorporates Usergrid. This will allow you to perform a query on the database and do processing of the results. Check out this presentation: https://speakerdeck.com/timanglade/coders-workshop-at-i-apis. In particular, see Section 7, which discusses using Usergrid and Node.js.

application -> database <-> web app communication

I'm working on a personal project that consists of a linux dev board and temperature sensor. I'd like to see a nice web 2.0 real time plot of the tempature from anywhere in the house. Coming from hardware/driver background so i'm not very familar with databases or webservers. I'm stuck trying to figure out how i can send new temperature values from an application to a local web server (also running on the dev board) which can be simulataneously viewed from a client web browser. I've attached a picture which shows what i'm trying to do:
http://img193.imageshack.us/img193/4742/92898822.jpg
I've written the driver, application and played around making an app using GWT. I'm stuck trying to figure out how to make the server-side application and database i.e. Do i need to make a seperate executable that embeds SQL to talk to both application and client via http or is there an easier, existing way to do this?
Thanks in advance.
Kevin
GWT is usually used with a Java application server. You can use JSON or XML to communicate with any kind of server, but I don't know how easy this is.
In a not embedded server you would install Java and an application server. You would also install a database server, but for simple projects you could avoid this by using an embedded DB like HSQL or Derby. For your situation I don't believe this is necessary.
The question is what kind of application server can you use in your platform? All application servers support some kind of CGI communication. This way you could connect your server with the application that samples the temperature values. I don't think there is a need for SQL or an embedded database.

Resources