In this article, we are going to see how we can start Next.js Server.
Next.js is a React-based framework. It has the power to Develop beautiful Web applications for different platforms like Windows, Linux, and mac. If you have little experience in react and looking forward to knowing more about react ecosystem then you should have knowledge about the Next.js framework.
Next.js includes its own server with the next start. In computing, a server is a computer program or a device that provides functionality for called clients which are other programs or devices.
Follow the below steps to start the server in the Next.js application.
Creating NextJs application:
Step 1: To create a new NextJs App run the below command in your terminal:
npx create-next-app GFG
Step 2: After creating your project folder (i.e. GFG ), move to it by using the following command:
cd GFG
Project Structure: It will look like this.
Example: Before starting the server we are going to add some text to our homepage. For that, Add the below code in your index.js file.
index.js
export default function Home() { return ( <div> <h1>This is a demo - neveropen</h1> <h2>Server is started</h2> </div> ); } |
Step to Run the application: Now to start the development server you have to type the below command in the terminal.
npm run dev
Output: This will start the development server for your Next.Js application and you will see the following output in the browser: