Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 102 additions & 0 deletions Binding_Next_JS_Server/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
# Syncfusion Angular Grid with Next.js server

A lightweight, production-ready pattern for binding **Next.js** server data to a **Syncfusion Angular Grid**. The sample supports complete CRUD (Create, Read, Update, Delete), server-side filtering, searching, sorting, and paging using Syncfusion **DataManager**.

## Key Features

- **Syncfusion Angular Grid**: Built-in search, filter, sort, and paging capabilities
- **Complete CRUD Operations**: Add, edit, delete, and update records directly from the grid
- **Custom-Binding**: Full control over grid data operations (search, filter, sort, page and CRUD actions)

## Prerequisites

- Node.js: LTS version (v20.x or later)

- npm/yarn: For package management.

- Angular CLI: For creating and serving the Angular client application

## Quick Start

1. **Clone the repository**
```bash
git clone <repository-url>
cd Connecting_to_Next_js_server
```

2. **Run the application**

**Run the Next.js server**

```bash
cd next_js_server
npm run dev
```

**Run the Angular client**

```bash
cd angular_client
ng serve
```

3. **Open the application**

The server runs at http://localhost:3000
Navigate to the local URL displayed in the terminal (typically `http://localhost:3000`).

## Configuration

**Security Note**: For production environments, store sensitive credentials using:

- Environment variables

- Secure storage solutions (e.g., Azure Key Vault, AWS Secrets Manager)

## Project Layout

| File/Folder | Purpose |
|-------------|---------|
| `next_js_server/app/api/health_care/route.ts` | Server-side API route handling grid data operations |
| `next_js_server/data/health_care_Entities.ts` | Entity model containing the data |
| `angular_client/src/app/doctors/doctors.ts` | Contains the Grid configuration |
| `angular_client/src/app/patients/patients.ts` | Dynamic route page |

## Common Tasks

### Add a Record
1. Click the **Add** button in the toolbar
2. Fill in the form fields (Doctor ID, Name, Specialty etc.)
3. Click **Update** button in the toolbar to save the record.

### Edit a Record
1. Select a row in the grid
2. Click the **Edit** button in the toolbar
3. Modify the required fields
4. Click **Update** to save changes

### Delete a Record
1. Select a row in the grid
2. Click the **Delete** button in the toolbar
3. Confirm the deletion

### Search Records
1. Use the **Search** box in the toolbar
2. Enter keywords to filter records (searches across all columns)

### Filter Records
1. Click the filter icon in any column header
2. Select filter criteria (equals, contains, greater than, etc.)
3. Click **Filter** to apply

### Sort Records
1. Click the column header to sort ascending
2. Click again to sort descending

### Routing
1. Click the **View Appointment Details** button in the template column of the Grid.
2. This will navigate to the appointment details page.

## Reference
The [user guide](https://ej2.syncfusion.com/angular/documentation/grid/connecting-to-backends/next-js-server) provides detailed directions in a clear, step-by-step format.

17 changes: 17 additions & 0 deletions Binding_Next_JS_Server/angular_client/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = space
indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single
ij_typescript_use_double_quotes = false

[*.md]
max_line_length = off
trim_trailing_whitespace = false
43 changes: 43 additions & 0 deletions Binding_Next_JS_Server/angular_client/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# See https://docs.github.com/get-started/getting-started-with-git/ignoring-files for more about ignoring files.

# Compiled output
/dist
/tmp
/out-tsc
/bazel-out

# Node
/node_modules
npm-debug.log
yarn-error.log

# IDEs and editors
.idea/
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# Visual Studio Code
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# Miscellaneous
/.angular/cache
.sass-cache/
/connect.lock
/coverage
/libpeerconnection.log
testem.log
/typings
__screenshots__/

# System files
.DS_Store
Thumbs.db
59 changes: 59 additions & 0 deletions Binding_Next_JS_Server/angular_client/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# AngularClient

This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 20.3.8.

## Development server

To start a local development server, run:

```bash
ng serve
```

Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.

## Code scaffolding

Angular CLI includes powerful code scaffolding tools. To generate a new component, run:

```bash
ng generate component component-name
```

For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:

```bash
ng generate --help
```

## Building

To build the project run:

```bash
ng build
```

This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.

## Running unit tests

To execute unit tests with the [Karma](https://karma-runner.github.io) test runner, use the following command:

```bash
ng test
```

## Running end-to-end tests

For end-to-end (e2e) testing, run:

```bash
ng e2e
```

Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.

## Additional Resources

For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
95 changes: 95 additions & 0 deletions Binding_Next_JS_Server/angular_client/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular-client": {
"projectType": "application",
"schematics": {},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular/build:application",
"options": {
"browser": "src/main.ts",
"polyfills": [
"zone.js"
],
"tsConfig": "tsconfig.app.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
]
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kB",
"maximumError": "1MB"
},
{
"type": "anyComponentStyle",
"maximumWarning": "4kB",
"maximumError": "8kB"
}
],
"outputHashing": "all"
},
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular/build:dev-server",
"configurations": {
"production": {
"buildTarget": "angular-client:build:production"
},
"development": {
"buildTarget": "angular-client:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular/build:extract-i18n"
},
"test": {
"builder": "@angular/build:karma",
"options": {
"polyfills": [
"zone.js",
"zone.js/testing"
],
"tsConfig": "tsconfig.spec.json",
"assets": [
{
"glob": "**/*",
"input": "public"
}
],
"styles": [
"src/styles.css"
]
}
}
}
}
},
"cli": {
"analytics": "8cf5da05-2933-4fe8-a602-eaa9cbacdb0e"
}
}
51 changes: 51 additions & 0 deletions Binding_Next_JS_Server/angular_client/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "angular-client",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"prettier": {
"printWidth": 100,
"singleQuote": true,
"overrides": [
{
"files": "*.html",
"options": {
"parser": "angular"
}
}
]
},
"private": true,
"dependencies": {
"@angular/common": "^20.3.0",
"@angular/compiler": "^20.3.0",
"@angular/core": "^20.3.0",
"@angular/forms": "^20.3.0",
"@angular/platform-browser": "^20.3.0",
"@angular/router": "^20.3.0",
"@syncfusion/ej2-angular-buttons": "^32.1.24",
"@syncfusion/ej2-angular-grids": "^32.1.25",
"@syncfusion/ej2-data": "^32.1.24",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.15.0"
},
"devDependencies": {
"@angular/build": "^20.3.8",
"@angular/cli": "^20.3.8",
"@angular/compiler-cli": "^20.3.0",
"@types/jasmine": "~5.1.0",
"jasmine-core": "~5.9.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.9.2"
}
}
Binary file not shown.
12 changes: 12 additions & 0 deletions Binding_Next_JS_Server/angular_client/src/app/app.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { ApplicationConfig, provideBrowserGlobalErrorListeners, provideZoneChangeDetection } from '@angular/core';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';

export const appConfig: ApplicationConfig = {
providers: [
provideBrowserGlobalErrorListeners(),
provideZoneChangeDetection({ eventCoalescing: true }),
provideRouter(routes)
]
};
Empty file.
2 changes: 2 additions & 0 deletions Binding_Next_JS_Server/angular_client/src/app/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

<router-outlet></router-outlet>
Loading