I want to host mongodb database remotely and access the database via querying it and display the results on web page.I came to know that mongodb atlas can be used for hosting it and in order to query the database crest is an API which can be used.But please help me ,whether crest is the thing which will satisfy the requirement that i want to achieve ?If yes then how to proceed with it.
Thanks.
I am currently using Atlas on a personal project and I must say that I am very pleased with it. It's good because you can try it for free and if your project starts to scale you can easily set it up according to your needs. You can also check Azure and AWS options. Regarding the question about Crest: if you need simple logic on your API, you can go for it. But if you want a more complex logic, I would recommend using express and mongojs or mongoose.
Related
I am trying to connect my Forge app to a sql database, but I have no idea how to do that. I am new to forge and web development, so I don't know how to look for the best approach to solve this.
I found a code that does exactly what I want, that is getting the data from a specific table of my database, but I'm not able to put this code inside my forge app, mainly because it uses a require() function and I can't put it inside my extension button.
By the way, I'm trying to make a button in my extension where I click, it access my database and get data from it.
Would be really nice if someone could help me with this silly doubt that probably already has a solution in the internet and I'm not able to find it.
Sorry in advance if it's too obvious.
This problem is more related to web development than Forge.
Your app should be made of 2 parts : the frontend (html/css/js) and a backend (probably nodejs as you tagged it).
Your frontend should not access the database directly. This is the job of your backend.
In your backend, add a library to access your database such as Sequelize (if you are working with NodeJS). Then you will do a request from your frontend to your backend to get the data from the database.
You probably have something working like that for your Forge Access Token, depending on what you use to start your development.
I am new to web development, but I am building a tool to help us visualize the customers in our database in a more concrete way (basically a CRM of sorts). Its a web app using a node.js backend and Vue.js for the front end.
THE BIG QUESTION - I found a connection.threadId query that can be run. If I save this threadID in a cooke or JSON web token, can I use this to have each user uniquely querying the database? If you need additional information on my issue, continue reading.
Essentially the problem I am running into is authentication. We were able to get a dummy user create that has read only privileges to the database, but this doesnt help the account management team. I am trying to find a way for them to be able to login with their own credentials and then be able to run queries from my node.js (javascript) backend using a series of get and post requests.
I am able to get the user to login with the SQL password and they can run the initial query (that fires upon login) but they then cannot re-query the database if someone else logs in after them (I realized that my variables were all globally scoped on the server.) I then moved everything client side in JSON web tokens, but I had to hash the database password to be safe which leaves me with another problem. My hash and the original database hash do not match, and that is not something I'll ever get access to. Not really sure where else to go with this at this point.
Please ask if you need any additional information to assist.
Thanks!
You probably can't.
You also probably shouldn't use variables on the SQL server for a web app like this. If you can refactor those into variables you can schlep around in the user session (or POST parameters or whatever), you're much better off, being more stateless (as far as the server components are concerned) and all too.
I'm making my first Electron app and I'm not sure whether or not I should use the MySQL npm package or whether I should just use a MySQL in standard JavaScript that loads when the application starts for a login page if you could give me any advice on which to use and how to do it, it would help a lot
Edit:
The kind of thing I'm making is an application where there is admins and standard users both using the same login interface and to login they will connect to an online mysql database where it will check if there login details are correct and if they are then it will either give them the standard or admin view in the application and I'm not sure whether or not I should use mysql in javascript or whether or not I should use the npm mysql package and if I should use that instead of using standard javascript?
Also i would like the application to be able to run offline where the user can login online and make edits to things in the app such as their username or password etc (things that would be stored in the database) and have it so when connection is re-established it allows the information in the database to be updated.
I'm simply looking for some advice on how i could do that or some pointers in the right direction like some documentation or some up to date tutorials which might be able to help me and I am new to node/electron and therefore please be patient :P
tl;dr; Checkout nedb
To interact with mysql database server, you will need it installed and running.
Ask yourself
Does user has mysql installed and server running?
How do you handle the users who do not have mysql server installed? Are you going to ask them to download it?
Do I really want to use this mysql or can my functionalities work with some other lightweight database?
For most cases, requirements are simpler and you will not need database such as mysql, I recommend to use lightweight databases such as nedb
For some really simple applications, I don't even use nedb, rather I simply write and read from a file but you seem to be past that simple situation.
I ended up using a remote mysql server and used the mysql node package to do this which is very easy to use
npm install mysql --save
https://github.com/mysqljs/mysql
Im coding a static page app using Angular, which shows various Instagram and Twitter posts of the company, and shows the details of the members. I have few questions regarding this, and would like any help.
Firstly, I have about 100+ contacts to display on the first page. Should I create a Json by myself and retrieve it from the service, or should I create a backend and save it there ? I do not have any backend as of now.
Other thing, I was able to retrieve Instagram Json with media content using their API, the doubt im facing is, once I have the call done, will the Json change automatically when the user adds/edits their posts? Or will the Json be the same as I first called it with? Any help is appreciated. Thanks.
For your case, as you have fewer data using Firebase is the best approach. If you write a backend and maintaining it would cost you more. You can use Firebase service URL to retire those records. In future, if you want to add more data it would be easy.My suggestion is Firebase.
Should I create a Json by myself and retrieve it from the service, or should I create a backend and save it there ?
Are you revealing credentials or other sensitive information in the client? That would be one reason to have a backend apart from Instagram or Twitter. Do you envision exhausting API rate limits of Instagram or Twitter APIs? That would be another reason; you could cache results in your backend to reduce external API traffic. Do you need to process (reduce? translate?) the data before it gets to the client, or are you satisfied with performing any processing on the client (e.g. is it fast enough)?
TL;DR: It depends a lot on your particular requirements.
If you do want a backend, the recommendation in the answer from #praneeth-reddy to use Firebase is excellent. If you only need processing/transformation but no caching or separate storage, then AWS Lambda may also be worth considering. If you need more control (build vs. buy), you could write your own backend.
...will the Json change automatically when the user adds/edits their posts? Or will the Json be the same as I first called it with?
Angular can help you update content automatically if the client side data (think browser JavaScript memory) changes via its automatic change detection functionality, but you would have to provide your own logic (e.g. in Angular services perhaps leveraging RxJS) to update the client side data based on data from the APIs. You could poll to update periodically, or for better performance listen for changes using an asynchronous event/push mechanism such as websockets or streams.
Am currently working on a website(html 5) that calculate the expenses for the user, after the calculation, user has to save it as report for future purposes. So i wanna know if there is anyway to connect the website to MYSQL database or any alternative way rather than create database using java script because am a novice on Js.
thankyou
ideally you should be writing some server side code to add this sort of information to a database. that way you can secure access to authorised users (i.e. logged in users) and your queries cannot be modified on the browser by any user. you can use a programming language like PHP (with a framework like Yii, CodeIgniter) which is quite lightweight.
Browsers have no built in mechanisms for connecting to a MySQL server.
Your options are:
Write a browser plugin
Write a web service and use JavaScript to create an XMLHttpRequest object to communicate with it
The second option is the most common one (and almost certainly the best since it doesn't require that the user install a browser plugin or that you give direct access to the database to all your users).
If you want to use JavaScript, then you can create your web service with (for example) Node.js and the mysql driver in npm.
You should use HTML5 Web SQL for this purpose. Here is link you can refer to:
http://www.tutorialspoint.com/html5/html5_web_sql.htm