How to use multiple frameworks at the same time? [closed] - javascript

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
I'm kinda confused about how node frameworks work. I've been suggested to use Express.js and ejs because of a specific feature I need (importing html). I'm not sure if it has everything I need, because I haven't done much research into what framework works best for me.
I need the feature as soon as possible to get my website back online. Can I use multiple frameworks at the same time? If not, can I use ejs and some other framework together? How easy/hard is it to uninstall a framework if I can't use 2 at the same time?
I know this sounds like I could just google this, but I've tired searching everywhere and all I get is "Top 10 Nodejs Frameworks for 2020" despite doing things like putting quotes around "at the same time".
Edit: just to clear up some things, I do know that ejs and express work together well. I don't know what framework I want to use, and I need to use ejs now.

EJS is designed to work with Express as they are different and complementary things.
Express is a web server framework. EJS is a template engine and is designed to work with Express. They work together just fine.
You can install 100 template engines or 5 web server frameworks and then just code with whichever one you want for any given project. Installing a template engine (or any NPM module) just puts some code on your disk. It sits there dormant until you actually load it into your project with require() or import. So, you can install as many NPM modules as you want and then just program with the ones you actually want to use for any given project. "Installing" an NPM module just puts code on the disk. It doesn't affect your project at all until you actually load and run that code with require() or import.

Related

Using react in a legacy jquery + java spring project [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
Backstory: My boss has given me the mission to figure out how to implement react into one of our existing codebases. The idea is to use this to test integration and see if we can slowly migrate out projects over to react. As well to demonstrate to those in charge improvement react can offer over jquery. The problem is I only have less than 2 years of web experience most of which is jquery and near zero of that is react. So I'm struggling to learn the process of integrating react. This is made more challenging by figuring out supporting systems like webpack, npm, and varies libs used with react.
Goal-1: Get a single page running react inside an existing layout that can support modules/libs
Goal-2: Get this page to play well with our jquery menu (option as I can rewrite it)
Goal-3: Get everything placed into its respective folders inside our src/main/webapp
Current state: I have a page loading react and babel using simple script tags. This works but is rather difficult getting any other react libs to load. As most assume npm is being used or commonjs at the minimal. Neither of these I have much knowledge with using/implementing.
What I need: Some guidance on how to implement react into an existing project. I've run over a few articles talking about the process but many lack details needed to understand what is going on in each step. For example getting webpack to export into the target directory so it can be bundled for use in tomcat.
Before this ends up closed, my high level thoughts is get your spring project into a state where it is exposing RESTful endpoints for getting and saving your data. Then build the react project separately from the current java or jquery projects, and have the react ui consume those REST apis.
Apart from that, this is a very broad question you are asking, with lots of ways to solve it, the above mentioned is only a starting point. I couldnt possibly go into complete architecture here..

Adding an express backend to vue-webpack-boilerplate [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I've just downloaded - vue-webpack-boilerplate - and the little I've seen of it looks really good :) (first time with webpack + ESlint)
I'm a little confused however - how can I go about adding an express backend to the project?
Not every route is always going to be a vue, sometimes it's an api request or a db call or the like - and if I do hookup an express backend, how can I choose what vue components I want to load?
Am I going about this completely wrong/have misunderstood what this is for?
Thanks
Edit: I've looked at http://vuejs-templates.github.io/webpack/backend.html - but that's not really cleared anything up
You might be confusing with npm build packages like webpack for front-end with back-end express project.
The boilerplate you mention is for front-end. It allow you to develop a static website either with or without SPA and end up with html, css and js files to be deployed at any static file hosting.
There is no wrong to make API call anywhere on client-side. E.g. on every route change, you specify what component to load and it can make an API to call to update the UI. That is SPA for client-side routing. You just have to make a separate express project for the back-end.
You can try Nuxt for server-side rendering (SSR). The main advantage for SSR is SEO friendly but not suitable for dynamic page like profile and checkout page. Nuxt is a universal (client or server routing) Vue app by generating static html during run-time. However it is differ than what you think you want to add express API back-end but you can still populate dynamic data with Async Data
Check this out JAMstack.

Add angular2 into existing nodejs app [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I was given an existing big ass nodejs app which contains both the UI and the back-end logic. I would like to split them up and am thinking of using AngularJS 2 for the UI part.
I have gone through some of the examples and know my way around Angular. However I do not know how to properly install it on the existing nodejs app - what do I include in the package.json .... what do I do with the systemjs.config.js, tsconfig.js and typing.json ? How to include the "typescript" parsing/compilation ?
Thank you
P.S. the nodejs app is running sailsJS framework.
I think you need to split the app into 2 layers (assuming this is possible):
1) the REST service layer
2) the Angular2 Front End layer
Node.js (maybe with the help of express) would run the REST service piece.
Angular2 would be the Front End part, calling the REST services offered by the Node server.
In such a scenario you would not have to 'install' Angular2 on Node. You rather would have to prepare a development environment (I suggest to use also Angular2 CLI) for Angular and start the development against the available services. Unfortunately these means that it may be difficult for you to reuse whatever pure FE logic has been developed so far (maybe with the exception of the css part).
I hope this helps

Use Javascript frameworks without build tools like grunt and gulp? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I'm trying out some modern Javascript frameworks like Angular, React, Vue and Ember, and they all want me to use build tools like npm, grunt, gulp, maven, etc.
Web-programming used to be fun. Just change some files, refresh the browser and see if it works. Now every time I change something, I have to build it again, which takes quite some time. I really hate to see that web-programming has become like this. I know the building can even be done automatically with these tools watching for file-changes, etc., but still, it just sucks.
My question is, when I want to use one of the mentioned frameworks, am I supposed to use the build-tools every time I want to run, or do I just need these for deployment and testing purposes (or not at all) ?
You don't have to use these tools. They're mostly aimed at people who want to use frameworks in larger projects, and have features that let you compile hundreds of JS components into one file. I personally use them mostly for automating build tests, unit tests, and bundling all the assets together on release days. Let's address the frameworks you mentioned one at a time:
React: React provides an already compiled version of their code on their getting started page
AngularJS: Same as react, there's just a file you can include, just look up "angular cdn"
Vue: They also have a file that you can just include.
Ember: See above
For most frameworks, you can just look up "name of framework CDN" to get an online hosted js file that you can quickly throw in to your projects for web development the old way.
Some libraries require building the code, some don't. From the list that you had, none of them require it technically. They can all work by simply including the js file in a <script> tag. However, there are many frameworks/libraries (such as sass or coffeescript) which do require a build tool, because the source code must be compiled to become html/javascript/css as understood by the browser.
Also, there's not really any reason to be so against using build tools. As you said, they can run automatically on file change, so they're really just in the background.

Can I use javascript to write xml files, or will I have to learn php/asp/mysql/something else? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I understand this question has been asked before, but I couldn't think of a simple definition of my problem to put in it's place. I am learning to do this informally, so I'm not exactly sure how to phrase questions/search for answers yet.
I'm trying to build a simple checklist program as I learn javascript - I'm doing this by hand without using any libraries (so no jQuery, just basic javascript). I have a functioning DOM interface getting formatted by CSS, all running in and editing the contents of a <div>, so that side of things seems fine.
I'm testing this off of my HDD and have no intention of hosting it anywhere.
Currently, I'm trying to solve my data storage problem without installing php/mysql/apache. I'd like to have each task list nested "subtasks" when selected, with one level of nesting.
To do this I'd like to create a new XML file every time I create a new task, and then append it's information to a list file (list.xml) so that I can navigate list.xml to dynamically display all the current primary tasks.
I've since learned that you cannot simply create new .xml files with javascript alone, for security reasons. While this makes sense, I'm now looking for other solutions.
What is the simplest way to store this information as it's entered? One solution I've considered is having just one XML file (so I always know what to point the script to), and using "<id>" nodes to slave subtasks to their respective primaries. This would, however, create a very long and disorganized XML file that would become cumbersome and annoying to traverse, forcing me to write a tricky method for looping through it.
Should I continue as I am to simply complete the project and help lock in my skills (it will be my first complete "program" with a gui of any kind that wasn't dictated by a guide or lesson), or should I bite the bullet and go through the annoying php install (I did this on my last tower and it was a frustrating time-consuming mess) and learn php/mysql/apache for all the server-side nonsense?
sry about tl;dr please help my pynchonesque code masters will kill me
You can't do much in web programming with only user side. Sooner or later you will have to learn also server side. And installing PHP is not so annoying. You can use wamp server. It has very simple installation.
If you're learning Javascript, I'd recommend staying with Javascript (don't jump over to PHP or some such just because it'll save you 5 minutes in configuration).
There are a number of really nice Javascript serverside frameworks that will happily write files to the file system or talk to a database for you. Node.js is currently the most popular. I don't want to start a flame war about how or why Node is superior to PHP, I'm simply saying that if you're a beginner, I wouldn't mix apples and oranges and just stay within one language.

Categories