This project is written in Node.js with TypeScript, using Angular.js framework for the frontend, with Java Spring Boot framework for the backend, and SQLite for lightweight database storage due to the small scale of the project.
The frontend app will run on http://localhost:4200
and backend app on http://localhost:8080
. Please ensure that these two ports are free.
Instructions on how to log in the app can be found here.
As the frontend is built with Angular.js, you must have Node.js installed on your device to be able to run it. A quick way to get started is to directly install Node.js on your system. You may download the installer here.
However, it is strongly recommended to use a Node version manager such as nvm to install Node.js and npm. You may read more about it here.
The backend is built with Java Spring Boot with Java 17, hence it is necessary to install the JDK on your device so that you can start the Spring Boot application without compatibility issues.
You may download it here.
If this is your first time running this project, you will be required to install the Node dependencies for the frontend Angular.js project.
You may can enter npm ci
into the terminal in ./frontend
folder. This will step will install all necessary dependencies based on the ./frontend/package-lock.json
. This process may take awhile.
To simplify this step, you may run the following batch script:
.\setup-npm.bat
A batch script has been created for your convenience in starting up both the frontend and backend application.
.\run.bat
NOTE: Amend the
JAVA_HOME
in this batch script to the Java JDK 17 directory on your device.
Alternatively, you may start the frontend app by entering npm start
into the terminal from ./frontend
folder, and entering mvnw spring-boot:run
into the terminal from ./backend
folder.
Manager Account (required to see and use manager dashboard)
Username: user1
Password: 111
Staff Account
Username: user2
Password: 222
This API supports JSON format. Please ensure request body is in a Content-Type: application/json
format.
POST /login
Parameter | Type | Description |
---|---|---|
:id |
string or ObjectId |
Required. Household object _id . |
// Valid Request Response
true
// Invalid Request Response
false
GET /user/:username
Parameter | Type | Description |
---|---|---|
:username |
string |
Required. To retrieve account details based on the username . |
// Valid Request Response
{
"accountId" : Number,
"username" : Object,
"password" : null,
"name" : String,
"role" : String
}
// Invalid Request Response
null
Cross-origin resource sharing (CORS) is a mechanism that allows restricted resources on a web page to be requested from another domain outside the domain from which the first resource was served.
By default, the frontend app do not have access toi the API endpoints, thus CORS is granted on the backend app for the frontend host and port of http://localhost:4200
.