Author : Tin Kit Wong
-
Setup mySQL and mySQL workbench (optional)
- Install MySQL https://dev.mysql.com/downloads/mysql/
- Install MySQL WorkBench https://www.mysql.com/products/workbench/
- Use MySQL WorkBench to connect to MySQL locally.
- Create a database named testdb
CREATE DATABASE testdb;
- Update PASSWORD field in ~/db/config/db.config.js
-
Install dependencies
yarn install
# starts server
yarn run dev
# test suites
yarn run test
Note : API Usage via Postman Collections; Download and import GovTech Assessment API.postman_collection.json
into your Personal Workspace and follow the examples given. Please see the description and examples of each EndPoint provided.
- Create Household
- Add a Family Member to Household
- List Households
- Show Household
- Delete Household
- Delete Family Member from Household
- Search for households and recipients of grant disbursement
- NodeJs / Express
- Sequelize ORM
- MySQL
- Leverages on MVC (Model-View-Controller) Architecture
- HTTP Requests handled at the Route Layer -> Controller Layer -> Services (which iteracts with DB Models) -> Database
- MVC helps to regulate the complexity of application by dividing into their respective layers/parts (ie. model, view and controller)
- This shows that each layer has a specific duty, allowing development & testing within each layer with a clear objective.
- Omission of View Component in MVC Architecture as there is no functional requirement. Can consider setting up views for visualisation requirements like backend dashboard
- Usage of MySQL due to structured and relational nature of data (ie. Households can have many family members, Persons have many metadata)
- Household must exist before Person can be added as Family Members to this Household
- Only expected/valid HousingTypes, OccupationTypes can be added. Define them in
app_root_dir/utils/constants.js
- The selection criteria for grant disbursement API Endpoint (/api/grants/checkElligibility) checks for households:
- householdSize <= the quried size
- household income <= the queried totalIncome
- There must be existing household and recipients elligible for grants for grant disbursement API EndPoint to work.