How to embed a database into my vuejs app? - javascript

I know this is a "generic" question, but please read it before judging:
I try to create a vuejs fullstack application that i can build and run with a single command. I use the vue-cli to create and build a project. Included is express and node (works fine). But I cannot figure out how to add database functionality to it. I thought mongodb and mongoose would fit, until I learned that I need a separate mongodb server running instead of getting it embedded within my build.
Is this even possible? I mean, android apps ship with SQLite that every app can use. Where do I need to research to get this job done? Google tells me to use mongoose, but it is not embedded as it seems.

As requested, as an answer:
Databases are usually part of the back-end (in this case nodejs). There's plenty of choices for embedable databases, the most popular one is SQLite.
It can be used either purely "in memory" or with persistence in the form of "database files". More information how to use it in node can be found in the node-sqlite3 documentation

Related

Do web applications made with Express.js need to be bundled for distribution? And what is the purpose for a distribution version of an app?

I hope the question is clear enough, I'll to to explain more in depth, but before that, I want to first say I'm new/fresh to web development.
I have been developing some apps on my own and have also followed some udemy courses and what I have had difficulty understanding is what is the purpose for a distribution version of the web app you are developing.
I first started a course that had some intro to PHP, MySQL, Wordpress, with a larger emphasis on HTLM/CSS and Javascript. The last project in this course was a single page website that used Webpack to bundle the project and create a distribution version of the project.
After this I followed a course which main project was a multi page app that used Express.js with .ejs , Node.js, Bootstrap and PostgreSQL, but I did notice there was no bundling for a distribution version of the app.
Last, but not least, I did another course that used React for the client side, and in the end there was a script for generating a bundle for distribution.
As I started moving my projects to a static server and getting them up and running forever with PM2, I stopped for a bit and was wondering why is there even a need for a distribution version of a project even needed if the websites look the same, but I assume the reason is so it runs more smoothly on a browser.
I'm just making assumptions here, but I assume the javascript from all the dependencies are put together on a single .js file or a small set of files to make it easier on the browser to process the website? Also for version control?
But if creating a distribution version of your app optimizes it for a browser, then how come Express.js doesn't offer this?
Maybe this is a very stupid question, I'm still confused by a lot of this stuff.
Maybe because they can do similar stuff, like webpack can throw up a server so you can see your app running, like React, but to access a database, you need to make an api call to a backend program like Express.js through axios or fetch. But Express.js is a server that can make query calls to a database and lets you see your app through views/.ejs.
Again, sorry if this sounds all really dumb, I just don't know anyone who I can ask these questions.

Read only access to Neovis.js

I am a rookie both in Neo4j and javascript.
I found out that the javascript Neovis.js can be used with a Neo4j database to render a visualization for queries. This is an excellent tool to develop and embed web applications using Neo4j. However, I soon realized that this has the potential to screw up the entire database since those queries can both read and write the database.
How do we avoid writing into the database when using Neovis.js?
Either don't allow any queries with the CREATE, MERGE, SET in your application to be executed or if you have an enterprise version create a read-only user.

Is it possible top upload `react` app with `mysql` to `github`?

I've made a siple web shop using react, node and mysql. I wanted to push it to github, but I'm not sure if it's possible to do that with database that's on my localhost right now?
Git is a means to version control code.
There would be no problems storing your program's source code and your database schema (along with any migration scripts) in Git.
Storing the data from your database is another story. You would need to export it. Git isn't designed as a means of storing backups though.
Github also offers Github pages for hosting static sites. That service is not suitable for anything that involves server-side programming.
yes, check heroku.its free at some extend.
i have used it for my project, with mongodb.
heroku uses postgresql but there are ways to make your mysql working.
i think there are already questions about that.

Spring-Boot with React JavaScript

As the title says I'm dealing with Spring Boot and react JavaScript at the moment. I would really appreciate it if someone would be able to answer me on a few small questions.
I created a separate react project using vscode IDE. Now I need to add it to my Spring Boot application. I have used Eclipse to code my Spring Boot application.Can I just transfer the react JavaScript files to the Eclipse IDE? Will it work like that?
Also, to configure these two together I read that I should use thymeleaf. What are you thoughts on this and do you think its better to use this.
You may not require to transfer any code from one IDE to another. I assume both this front-end(react) and middle layer(spring boot) are two separate project.
You can still run the boot project in eclipse pointing to same localhost(for development) with a different port and front-end in a different port.
I found this example is quite useful
The modern way to think about your React and Spring apps as of two completely separate applications. The React app is the "front end" application that is displayed to the user and holds the logic for all the user interactions. Spring boot is the "back end" service that holds the state of your application and helps you to save and fetch data.
To get started try building and running your React app from something like Create React App. It is easy to set up a local development server. You should also understand that the React app that you get after building is just some static files - so you can host them very easily and cheaply without need for an actual server. I personally use S3.
Now to your Spring application. This is your 'API' layer and you should read about using APIs for example here: Official Spring Docs .
You still theoretically CAN bundle both together and serve the React bundle out of the Spring static files directory but you will likely find this will get awkward fast. Here is an example of someone doing exactly this
As for Thymeleaf - in the React world you will likely end up using JSX for your templating needs. It is a wonderful way of closely integrating your js and html code and creating highly reusable components.
You can build an automated container deployment. This allows you to test, build and deploy your backend and frontend with every git push to your server.
For example google some keywords: Kubernetes, Docker, Gitlab CI.
There are much more solutions and platforms to build a system for automating deployment.

How to deploy a Meteor.js app through Galaxy without MongoDB?

Let's say I want to build a SPA using Meteor.js but I don't need MongoDB right away and would like to add MongoDB later when I have more data, or at least set the MONGO_URL="null" just so I can deploy through Galaxy without the console blowing up. For now I just want/need a static site, but to also have the flexibility to make it a dynamic SPA later. Is this possible through Meteor and Galaxy?
I have combed through the Meteor docs https://guide.meteor.com/deployment.html
but it doesn't seem possible through their documentation.
https://galaxy-guide.meteor.com/deploy-guide.html
This would be a great feature and thanks for any info!

Categories

Resources