Socket.io Architecture - socket.io

Im getting into socket.io currently and I want to integrate it into one of my apps. Here is the structure in my app :
My question is. Where do I create socket.io handlers in my case. For example If I needed to have an User handler would I defined it in the user module as a new file, the router, the controller or perhaps its place is not even in modules ? I picked up socket.io yesterday sorry if my question is stupid.

Related

Recreate a GUI for an application

im new here, lately i've tried to find a way to recreate a GUI for an application and still maintain his functionality.
Let's take SnapChat as example, i would redesing the application GUI but without editing that part of code that makes the application function.Im sorry if im not giving very specific explanations but i really don't know how to say it. Im really clueless on how to do so, and even if is possible in in the first place.
If someone could help me out it would be really apreaciate
So far i haven't tried anything bheside searching something online.
I believe you want to make a 'frontend' that looks like Snapchat and have it functioning like the real site. You will need to have a backend will all the features of Snapchat. Most websites on the internet have two parts to them - frontend and the backend. And most sites won't allow you to access their backend from other frontend for security reasons.
I personally don't use that site so I don't know about its features, but assuming it's a chat platform you will need user authentication and some way to store your messages.
You should start out with React or Vue.js, and work your way up to responsive sites like Snapchat.
A quick and easy solution would be to create an extension that changes the styling once the site loads on your machine so you don't have to code your own front-end.

Spring Controller get Variables from a different Website

I was wondering what would be the best way to achieve the question that I have posted? So for instance if I pressed a button it would go to the controller which would go to this address https://www.premierleague.com/results and then in this address it would get the home team name and away team name. Would this be possible via Spring. Which I can then save into the database.
Is there any tutorials, that people know off that could answer this question?
Cheers Jeff
You want to perform a http-query against another REST-Service within your application, which of course can be done.
I suggests you to look into this tutorial by Spring: Spring - Consuming Rest
This one should get you started on how to use the built in http-client of Spring.
Edit: The url you posted of course serves a complete website, its not a REST-Endpoint. If the premiere league offers an API, you should use that. If not you can of course request the whole webpage and scrape it for the information you need.

Web Dev stacks - GONE WILD --- Best Practice Architecture & Deployment?

I've run into a problem that I'm sure many new/junior web developers are facing. Before I state the problem, it's best if I first list the events that drove me to the "issue".
Step 1 - The Front-End:
I followed tutorials which allowed me to create a Vue project using the vue-cli - I now have a nice front-end ready to go, albeit it is in a way "standalone". It sits in its own directory.
Step 2 - The Back-End:
I move on, I start to look at the back-end. Laravel plays well with Vue so I go with it. Once again I follow tutorials, I create a database and an API. Fantastic.
I now have the barebones core elements for a CRUD application. However, the way the back and front end are connected seems to be convoluted (although this may be due to my inexperience and improper understanding).
Solution 1:
Some tutorials insist that the Vue project is "re-created" within the Laravel directories so Laravel is in charge of rendering the views.
Solution 2:
Others, from what I can tell keep them physically separate and have the front-end interact with Laravels API only.
What are the best practices when it comes to stack architecture? Should we aim to bundle the stack together as proposed in solution 1? Is solution 2 even possible or is that due to my misunderstanding? If it is, how is deployment handled?
From my point of experience, both are correct and the answer depends on what you want to build 😀
First, if you have a simple website and you want to make the front-end of it in vue and it is only this one website, you can put it all together and make the frontend in Vue, which is handled by laravel in the backend and you are done.
Second, the step further, is for this case, that you can have several frontends for your project. Example: You have a website and several (native or universal) apps to display your data. In this case, you can build an API, that handles all the logic, all the business secrets, and this stuff, that no one should know in detail. After that, you are free to build any frontend (Vue, native, plain-HTML), whatever) you like, that's the only purpose is to display the data the API gives back (with some little logic in it, of the cause, but the secret business logic is hidden in the API). You can even outsource the generation of an app, so you build the website frontend in Vue and another one can build an ios-app with swift or an android app with kotlin.
Hope, you get the point, the answer is, as often: it depends 😉

Why should I use strapi cms with React? [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 2 years ago.
Improve this question
I want to start a project but I am unable to select a technology. I basically work in JavaScript. So, develop a project with JavaScript both in front end and back end will be good for me. But I need a suggestion regarding a headless cms called Strapi. Why should I use it with React? What is the advantage and disadvantage of using strapi with react. Because Strapi is still fixing many bugs they had with their alpha version. So, I need a suggestion for this case.
You are not required to use React in your client application while creating a project with Strapi. The whole concept of is that Strapi is front-end agnostic which means that you can use it with your preferred framework or library.
The administration panel which is provided with your project is built with React, however it is completely different than your client application.
You already said, Strapi is a Headless CMS, which is defined as:
A headless CMS is a back-end only content management system (CMS)
built from the ground up as a content repository that makes content
accessible via a RESTful API for display on any device.
source
This explains why it is NOT A MUST to use a React Library, #scoupette pointed out. It does not work with REACT itself, it just sends you a data as a response, when you query something or gaining access to somewhere.
Strapi is meant to stay as a backend. Be responsible for all hard work like authentication, content type management and flexibility. When you create a content type in Strapi, you are not limited by creating only Posts or Pages, as it would be on a Wordpress default CMS configuration.
When you start developing in Strapi, generally is enough to control the backend and whole system you have created only by sending and receiving some JSON data between the listening server on default :1337 port. I do it with Postman. Whenever you decide to build a frontend, you start "rendering" the JSON responses got from Strapi. They might be displayed on your web app using: React, Gatsby, Angular, Next.js and many more. You can find their "Blog" demos with those frontend frameworks on the website.
Now lets have a look at the second part of the question:
What is the advantage and disadvantage of using strapi with react
Let's reassemble the question: Pros and Cons of using React with a Headless CMS. To know that you have to compare it with other opportunities we have, but that might get us out of the topic. Instead you might like to refer more experienced users of the frameworks in The Best JS Frameworks for Front End.

Laravel: changing from Blade to JS frontend framework

I have a Laravel application which is using Blade as the frontend. I'm feeling the better (more future proof) option would be to switch to Angular, Vue or React, (not entirely sure yet which one I will use but that's not the question of this post)
I've always thought that the backend code should expose an API in order for these JS frontend frameworks to work. I currently don't expose any sort of API.
I basically designed it in the normal way:
define route pointing to controller
create controller function and direct it to a view
create the Blade view
Couple of questions:
Should I redesign my backend to expose such an API?
Can I call Angular/Vue/React code from my controllers, similar to what I'm
doing with Blade?
In case the answer is yes to question 1,
shouldn't I consider changing to Lumen then?
using frontend framework means you would most likely build you backend as an API,
a common scenario is:
a single route the points to a controller which loads the angular/vue app
the angular/vue app would handle views and templates.
once the app is loaded you only need to communicate with the server through the exposed api's
you can't call you js code from laravel controller and you probably won't need to.
as for your question lumen vs laravel, I think it's up to you to decide that. both have pro's con's.

Resources