To display a customer list based on search set to customer's First Name or Last Name and filters set to Company Name. I have used MERN tech stack creating the backend end in node, express and mongoose. The dependencies installed and work tasks are tracked in GITHUB issues url - https://github.com/RajiDurai/customer-management-backend/issues. I started this project by implementing the back end first and tested the api using POSTMAN inputting the endpoints and fetched test data from local mongo db set up.
git clone <repository_url>
cd backend
npm init -y
git add .
git commit -m "Initial commit"
git push origin main
Testing
Make sure you have Node.js and npm installed.(https://medium.com/@hayasnc/how-to-install-nodejs-and-npm-on-mac-using-homebrew-b33780287d8f)
Create a new Node project:
cd customer-management-backend
npm init -y
Install any necessary dependencies (e.g., express for server coding, cors - cross origin request and mongoose - Object database modelling):
npm i express cors mongoose nodemon dotenv
Create a /routes folder and create customer.js for implementing customer search and filter
Harcode imput values in json and test the end points using postman
Install mongo db before proceeding to next step(source: https://www.sqliz.com/posts/install-mongodb-on-macos/)
To start mongo service, use brew services start mongodb/brew/mongodb-community
To access mongo shell, use mongosh.
(Note. command 'mongo' doesn't work after version 6)
Create a /models folder and create customer.js for creating customer schema.
Database schema:
[
{ id: 1, firstName: 'Raji', lastName: 'Durai', company: 'NewRelic' },
{ id: 2, firstName: 'Rachel', lastName: 'Smith', company: 'Google' },
{ id: 2, firstName: 'Dhara', lastName: 'Thamil', company: 'Google' }
];
In the project directory, you can run:
npm start
Runs the app in the development mode.\ Open http://localhost:5000 to view it in your browser or use POSTMAN.
npm test
Launches the test runner in the interactive watch mode.\ See the section about running tests for more information.
Your app is ready to be deployed!