This example demonstrates how to use malaysia-postcodes in a Node.js environment with both ES modules and CommonJS.
- Node.js 18.0.0 or higher
- Navigate to this directory:
cd examples/nodejs- Install dependencies:
npm installnpm start
# or
node index.jsnpm run start:commonjs
# or
node index.cjs- Getting all states and cities
- Finding specific cities and postcodes
- Using the universal search function
- Getting random data for testing
- Both ES modules and CommonJS syntax
The examples use different states and cities to show various use cases of the library.