Simple project that demonstrates Next.js routing.
-
Run the application.
npm install npm run dev
-
Navigate to http://localhost:3000/webapp.
- Next.js supports subpath of a domain through the
basePath
configuration innext.config.js
. This means that the root directory of the project will be severed through the url that is prefixed withbasePath
than the default empty string "". For example, ifbasePath
='/webapp'
, the root url for the web application can be accessed throughhttp://example.com/webapp
. - To access the
basePath
programmatically in code, we use theuseRouter
hook.