This is a Next.js project bootstrapped with create-next-app
.
Environment variables are defined in ./.env.local
file. You need to create an .env.local
file in the root directory before run
.env.local
contains three environment varibales:
BACKEND_URL
# the address of the backend serverDATABASE_URL
# the connection string of the databasePOST_DB
# the name of the database in which posts are storedExample of .env.local
file:
BACKEND_URL="http://localhost:3001"
DATABASE_URL="mongodb://127.0.0.1:27017"
POST_DB="posts"
If you have not added backend url to the system environment variables, please set them in .env.local:
NEXT_PUBLIC_BACKEND_URL="https://backend.example.com"
docker build --build-arg FRONTEND_PORT=3000 -t moral-front-end .
docker run -p 3000:3000 moral-front-end
Add node and npm to path.
node --version
npm --v
npm install
npm run build
npm run dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying page.tsx
or layout.tsx
in app folder. The page auto-updates as you edit the file.
/app
: Routing folder, this is where you organize routes and degisn the layout for each route.
/components
: Store reusable UI components that can be used throughout the application
/lib
: Store reusable utility functions, custom hooks, and other non-component modules that supports the main application functionality.
/public
: Store static assets such as images, fonts, and static files.
/package.json
: Node.js configuration file.
To learn more about Next.js, take a look at the following resources:
You can check out the Next.js GitHub repository