Can i write all of my serverside inside nextjs? [closed] - node.js

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 9 months ago.
The community reviewed whether to reopen this question 9 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
In nextjs u can write API routes using the api named directory inside the pages directory, thus i was wondering if i can write all of my server code(api endpoint,database queries...ect) inside of NextJS instead of having an actual nodejs app running elsewhere?

The short answer: Yes. Nextjs is in fact an Nodejs app itself.
The long answer:
Depending on your apps usage and scale and the size of your team there are some nuances to consider.
If you use Nextjs for both Server-side Rendering (SSR) and handling api calls, it will effectively have two responsibilities.
This is perfect for small teams because the stack is relatively uncomplicated and all in the same repository (and module).
At a certain scale you might want to optimise deployments to gear towards either rendering or handling api calls. It might become difficult to keep both extremely highly performing - at which point a separate, specialised, backend might become relevant.

Related

I keep getting errors when I try to make a multiplayer game in python [closed]

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 have been running into problems recently where the client-side of a networking game never read/recognizes the server. When I tried to use the socket module the client never accepts the socket. I used a module called NetworkZero, but that never returned more than None when I used .discover(). I have no idea what the problem is. Any ideas are appreciated
There are many ways to set up an interface between clients and servers.
The easiest is probably to start with HTTP especially in Python where you can just use requests and poll for your data.
This will get you to prototyping quickly and then you can put your focus into optimizing when you start running into issues.
Of course this may be a less than optimal solution depending upon the nature of your game. Without context I would recommend using simple client/server communication systems you understand.

Which load testing method is better? API testing or full website testing [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 have an application that we implemented kind of a microservices type architecture. The application contains 6 services (6 Docker containers). I need to load test this application. As I don't have much experience in the testing field, I'm not sure which method to use.
Right now, I have used the Gatling Load testing application for the load test. Here, I record the testing script by start the recorder and wander around my application to record all routes. I have gone through most of the routes in that single recording in order to mimic a practical user. I thought, normally users use an application like this and I can load test with its 1000 times by editing the number of threads/users.
Later I read about API testing which we will focus on APIs. Loading each APIs with a heavy load. So, I'm confused that which testing method should I use? If we go for API testing, it will provide only how much we can scale for that particular API right? (Not sure)
Is there any issue with my method of load testing?
It depends entirely on what you hope to achieve...
If you're looking to validate that your entire application (code + production infrastructure) can handle a given load, then driving as though going through the full website is the right path.
However, if you're looking to see how a particular api scales or want to help developers explore the ramifications of changes, then you will probably want to just drive that API directly to avoid other limitations your system may have.

What is the JAMstack web development architecture? [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 keep seeing references to JAMstack web development architecture.
From the web page Jamstack.org it is not obvious how JAMstack is different from the common JavaScript SPA frontend with REST API backend architecture.
What is the key difference?
Javascript Heavy front end - APIs for everything else - templated Markup
jamstack.org is the canonical site with examples and explanation
The key thing that differentiates JAMstack from other architectures is the middle part. APIs for every back end function means that backend can be spread out/scaled with ease.
EDIT: I should add that the term was coined by a CDN company Netlify which stands to benefit from a wider adoption of the architecture.

Modern Web Application - Design [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 5 years ago.
Improve this question
I am building a large web application in node.js and I'm always faced with the question 'where should the heavy lifting be done?' I was always taught that the 'logic' should always be done in the backend of the application, but with modern computers and browsers being so powerful it begs the question if some of the heavy lifting logic can go in the front end.
So context to my specific application. Using angularjs and postgres. A specific question is: would it be a bad practice to have the back end api fetch the rows from the database and pass it to the front end. And then have the front end deal with the logic of deriving the information from the rows? Things like counts with in date ranges and such. (ignore security for this question) or should all the be done on the backend?
If it deals with script that doesn't need to be hidden or is not a secret, then I would suggest putting most of it on the front-end, it would lessen the stress on your server and give you more space to run more processes at a time without filling the ram.

Is it best to use Node.js or SignalR [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 7 years ago.
Improve this question
At the risk of this question being closed I will ask anyway.
I have been looking at the different JavaScript Frameworks as most jobs roles seem to want:
angular.js
Knockout.js
Node.js
Whilst i can see Angualr.js and Knockout.js provides a MVC construct to the markup pages (though still not sure which one is best to use) I cannot see what is the case for node.js?
Whilst I appreciate node.js is good for real-time comms but so is Signalr as they both use long-polling.
At present I use signalr to update images on my clients.
is there any purpose to swapping this out for node.js?
Like I said this question could be voted to be closed as it may seem to be asking an opinion - and that would be an answer to me in itself as it would be down to developer choice but is there a DEFINITIVE reason to use node.js over signalr?
thanks
One reason to use node.js is code redundancy. Both the server and client run the same language, thus they may share a certain part of the codebase, meaning potentially less to write. With libraries like Browserify this process can be made a lot more transparent and writing the client-side can be almost indistinguishable from server-side development. Another opportunity this opens up is both client and server side rendering + MVC setups with, for example, rendr.js. So you can have both the fast load speeds of server-side and responsiveness of client-side rendering. If any of this will be useful naturally depends on what you are developing.

Resources