The idea is to bundle the MySQL database within the npm app. The reason behind this is because the app is intended to run as a stand-alone desktop application built using Electron and, of course, many other modules.
So far, all of my searches for a MySQL database module only leads to the drivers. All other tutorials talk about the typical web app set up wherein the MySQL db is installed in the server. A comment from another post discussed how to set up MySQL db in server and just mentioned that if it's a desktop app, it's a whole other issue. I want to know if there is a way to do this or if it isn't possible at all.
After further research (and a lot of compromise in the initial design), I decided to use Lovefield by Google. It is the closest to what I have been looking for since 1. it is embedded in the browser and 2. structured query is how you get data. Still hoping there would be a solution to an embedded MySQL database in an Electron app.
Sometime in the past, I have managed to embed a full Drupal CMS installation inside of node-webkit (https://nwjs.io/). It was configured to proxy all the known PHP files to the embedded PHP installation. Then we have simply imported the sql dump file into sqlite and the entire thing worked out nicely. You might want to give that a try.
As #jd-hernandes pointed out, sqlite could be the answer you are looking for.
Related
I have a doubt.
I would like to know if it is possible to insert data (100K data) that I have in a CSV file, directly to a table in Oracle, using NodeJs.
I have looked for several ways, but I have not found a solution, only the use of external tables but the problem is that I must save the CSV file in a specific directory.
I don't know NodeJs, sorry.
But, from Oracle's side of story, you could use an external table (as you've already mentioned). If that "specific directory" is located on the database server, great! as you'd have to create a directory (an Oracle object) which points to that filesystem directory (and grant read and possibly write privileges to user which will be using that directory).
If it isn't located on the server, you'd still be able to do it by using UNC (universal naming convention).
Another option is SQL*Loader, a command-line tool which can be used on your local PC (you don't have to have access to and "directory" which is related to the database server in any way). You do have to have SQL*Loader installed, of course. It comes with every Oracle database; if you don't have it installed on that PC, you'd install Oracle Client.
There are various Node.js modules to read CSV files. Use one, and then when you have the data in Node.js, you can use node-oracledb's executeMany() to insert multiple rows at once into the DB, see the node-oracledb documentation Batch Statement Execution and Bulk Loading.
However, I would probably go with the earlier solution and use SQL*Loader, see https://blogs.oracle.com/opal/oracle-instant-client-122-now-has-sqlloader-and-data-pump
I am a relative beginner to working in Apostrophe. I'd like to start off by saying its a pretty great ecosystem and I've enjoyed the experience so far. However, I've run into an issue thats a bit confusing.
I've been using it to build a site for a client and I've run into a very odd issue. I have installed an instagram widget that I found via npm (https://www.npmjs.com/package/#kwsites/cms-instagram-widgets) and used it on my local host with relatively no issues, it worked and I moved on with my life.
However now I'm trying to deploy the site and the Instagram widget is not showing up in the browser when viewing on the server. Again the widget shows up perfectly fine in the browser when viewing off my local host which would indicate it did not install correctly on the server but after following all of the post install steps on the linked npm package, I am completely unsure of what to try next.
I have confirmed that the #kwsites package folder is in public/modules/ directory
Any help/tips from any of the Apostrophe experts out there would be appreciated.
I am using stagecoach for deployment (again, a great product) and mechanic to manage nginx. I don't know if any of this matters but the widget is making some API calls to Instagram, don't know if they would be affected by either of those tools.
EDIT: Inspection in safari yielded the following from my local host
And the following from my server
It just looks like the widget is not being generated and I cannot find any errors in the console. Note I can add and remove a widget, I just can't get any content to generate on the server (but can on local host).
So as noted in the comments, I believe the issue was due to instagram's legacy api requiring site authorization. However with Facebook pushing the new Instagam Basic Display API, the legacy is going to be killed at the end of this month anyway/apps will stop working. So I found this blog post and found it easily adaptable to an Apostrophe module. It requires signing up for Zapier but a basic account is free and its a really interesting tool. This solved my needs
I have thoroughly searched the web about creating a website using React as a front end and PHP as a backend for like a week now. I have found many solutions about configuring webpacks and stuffs. But most of them only aim for index.html. So, I decided to create one LARGE react app and used CDNs of React, ReactDOM, and Babel to run it on index.php which is running on XAMPP. The main reason for creating one large app is because I cannot use full functionality of creating components and importing them.
But now, I want to use MDBootstrap, and its React components. But I cannot use them since importing is not available. I have watched tutorials and read articles about webpack and configured it. But all those were for index.html. And lastly, I have also found tutorials using PHP, XAMP(MySQL), and React. However, most of them run on Node server rather than XAMP server.
So I want to create something like
Website
react_app
index.php
where react_app is created by create-react-app or does have a same functionality as it like imports and stuffs. I do know that NPM server runs index.html from /build/, but I do want to run it on XAMP server using index.php.
Here is a link you can follow to do what you are asking for https://medium.com/#MartinMouritzen/how-to-run-php-in-node-js-and-why-you-probably-shouldnt-do-that-fb12abe955b0
and a possible other answer here Execute PHP scripts within Node.js web server
Only thing is, it is not really advisable to do this. It carries a number of security risks. I would advice you learn to seperate concerns and follow the Model-View-Controller (MVC) design attached to React.
You can still have React as your view while PHP is in the back. requests are sent and received through an api call. Check out this simple tutorial on achieving this https://blog.bitsrc.io/how-to-build-a-contact-form-with-react-js-and-php-d5977c17fec0
I hope this helps you with what you need. If it doesn't, let me know. glad to help!
I'm currently making an application using ReactJS for the front-end and NodeJS for the backend, however, I'm confused regarding how to connect those two.
I read about both, server-side rendering and client-side rendering.
I followed this tutorial (https://www.fullstackreact.com/articles/using-create-react-app-with-a-server/ ) as to how to connect my ReactJS app, which I created using creat-react-app and my node backend, however, I read that the solution of adding "proxy": "http://localhost:8000" (or whatever port node runs on) to the package.json file is only suitable for development.
Anyway, what I would like to know is: What is the best way of connecting ReactJS and Node.js if the user should be able to enter,delete or update data, which is saved to a database?
You should check out Nextjs. It is based on React and NodeJS.
I believe this is exactly what you are looking for. It is an easy-to-use framework that handles all the difficult stuff when it comes to server rendering while keeping the frontend async and dynamic. Besides that. When you get better using it, you can do in dept configuration to optimize to you need. Hope that helps.
Try out one of the examples on the git repository.
So I have just been getting into learning NodeJS as part of learning how to build a webscraping tool for a project I wanted to make.
I have all the content I need from the NodeJS file when I run the file directly through the terminal, but I wanted to know how to run the code directly from a website I am building to display the content I get from webscraping.
Any and all help is appreciated!
(Also I am new to stackoverflow, so if you need any more info then I would be glad to help!)
Since Node.js runs on server side, you need to call the Node.js server through ajax and get the response back.
This website shows how to do Web Scraping in Node.js, now when you get the data pass it as a response to the browser.
You may also check Express.js which gives you "Fast, unopinionated, minimalist web framework for Node.js".
So you have working node application written in javascript. Perfect.
Now you want to run that in browser mode. you can use browserify for the same. Browserify will package all the nodejs module in a bundle and let you require from the browser.
Not exactly sure if this is what you are looking for, but you should look into a cloud9 space (its free) and using express to render the HTML. It's pretty straightforward.
I think Nodejs tutorial in tutorialspoint [http://www.tutorialspoint.com/nodejs/] is powerful solution. It is just advice.