Requirements: NodeJS
-
npm install -
npm run start -
npm run dev- To run in development mode
Swagger docs can be found at http://localhost:3000/docs when the app is running.
npm run test
The server will listen on port 3000, and it exposes the following APIs:
-
POST -
/account- Create a new bank account- firstName - string
- lastName - string
- dob - date
- accountType - string ('savings' or 'current' or 'checking')
- initialBalance - number
- generates a unique 10-digit account number with the holder's name, account type, and initial balance
-
GET -
/account/:accountNumber- Fetch account details by accountNumber- accountNumber - must be 10 digits
-
GET -
/media/account- Fetch all bank accounts
This project follows the clean architecture to achieve separation of concerns by dividing the software into layers.
-
domainLayer - contains core business logic and entities. It is independent of any external technologies or frameworks. -
applicationLayer - orchestrates and coordinates the use cases (services) and interacts with the domain layer. -
adaptersLayer - contains the implementations defined in theapplicationlayer. -
infrastructureLayer - contains the external components and technologies used by the application. It deals with the technical details of how data is stored, communicated, and presented.
The server.ts at the root of your project is the main application file, setting up the express server, middleware, and routes.