Node Functions on EdgeOne Pages - Koa Demo Website
A demonstration website for function requests developed with Next.js + Tailwind CSS + shadcn/ui technology stack, showcasing how to deploy and run Node Functions based on the Koa framework on EdgeOne Pages.
| Framework | Next.js |
| Use Case | Starter,Pages Functions |
Node Functions on EdgeOne Pages - Koa Demo Website
A demonstration website for function requests developed with Next.js + Tailwind CSS + shadcn/ui technology stack, showcasing how to deploy and run Node Functions based on the Koa framework on EdgeOne Pages.
๐ Features
- Modern UI Design๏ผAdopting a black background with white text theme, using #1c66e5 as the accent color
- Responsive Layout๏ผSupporting desktop and mobile devices, providing the best user experience
- Real-time API Demo๏ผIntegrating Express backend, supporting real-time function call testing
- Componentized Architecture๏ผUsing shadcn/ui style component system
- TypeScript Support๏ผComplete type definitions and type safety
๐ ๏ธ Technology Stack
Frontend
- Next.js 15 - React full-stack framework
- React 19 - User interface library
- TypeScript - Type-safe JavaScript
- Tailwind CSS 4 - Utility-first CSS framework
UI Components
- shadcn/ui - High-quality React components
- Lucide React - Beautiful icon library
- class-variance-authority - Component style variant management
- clsx & tailwind-merge - CSS class name merging tool
Backend
- Express.js - Node.js Web application framework
- Node Functions - EdgeOne Pages serverless function
๐ Project Structure
express-template/
โโโ src/
โ โโโ app/ # Next.js App Router
โ โ โโโ globals.css # Global styles
โ โ โโโ layout.tsx # Root layout
โ โ โโโ page.tsx # Main page
โ โโโ components/ # React components
โ โ โโโ ui/ # UI basic components
โ โ โโโ button.tsx # Button component
โ โ โโโ card.tsx # Card component
โ โโโ lib/ # Utility functions
โ โโโ utils.ts # General utilities
โโโ public/ # Static resources
โโโ package.json # Project configuration
โโโ README.md # Project documentation
๐ Quick Start
Environment Requirements
- Node.js 18+
- npm or yarn
Install Dependencies
npm install
# or
yarn install
Development Mode
edgeone pages dev
Access http://localhost:8088 to view the application.
Build Production Version
edgeone pages build
๐ฏ Core Features
1. Main Page Display
- Project title and description
- One-click deployment and documentation view button
- Express code example display
2. API Call Demo
- Real-time function call testing
- Loading status display
- Result display
3. Responsive Design
- Mobile-friendly layout
- Adaptive component sizing
- Touch-friendly interaction
๐ง Configuration Explanation
Tailwind CSS Configuration
The project uses Tailwind CSS 4, supporting custom color variables:
:root {
--primary: #1c66e5; /* Primary color */
--background: #000000; /* Background color */
--foreground: #ffffff; /* Foreground color */
}
Component Style
Using class-variance-authority to manage component style variants, supporting multiple preset styles.
๐ Documentation Entry
- EdgeOne Pages Official Documentation๏ผhttps://docs.edgeone.com
- Next.js Documentation๏ผhttps://nextjs.org/docs
- Tailwind CSS Documentation๏ผhttps://tailwindcss.com/docs
- Express.js Documentation๏ผhttps://expressjs.com
๐ Deployment Guide
EdgeOne Pages Deployment
- Push the code to a GitHub repository
- Create a new project in the EdgeOne Pages console
- Select the GitHub repository as the source
- Configure the build command:
npm run build - Configure the output directory:
.next - Deploy the project
Node Functions Configuration
Create a node-functions/ folder in the project root directory, adding an Express application:
// node-functions/express/[[default]].js
import express from "express";
const app = express();
app.get("/", (req, res) => {
res.json({ message: "Hello from Express on Node Functions!" });
});
export default app;
๐ License
This project uses the MIT License - see the LICENSE file for details.