Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Next.js Needs a Node Server Running?

How does Next.js SSR working exactly.

If I don't care SEO at all then I can use React right? What if i care about SEO and don't want/need a node.js server in my background.

I have an API written in PHP. I tried in my local server to send requests from Next app to PHP Backend. In a real application do i have to create a Node.js backend in my server or is it enough to install Node and Npm only to install Next and it's dependencies?

like image 376
Doğukan Akkaya Avatar asked Apr 21 '20 16:04

Doğukan Akkaya


1 Answers

Any page that uses getServerSideProps, Next.js converts that page to a lambda function. You don't need a node server running 24/7 for hosting your application.

Also, if you don't use getServerSideProps, Next.js by default will pre-render your page, this page gets cached on a CDN.

So yes you can make API calls to your PHP backend, without the need for a setting up a nodejs server yourself.

Hope that answers your question.

Thanks

like image 156
Angad Avatar answered Nov 13 '22 18:11

Angad