This simple Node app was created by DAO Trung Hieu trung.hieu.dao@gmail.com for the d3hiring assessment.
The assessment text can be found at docs/dev-assessment.md.
A temporary live version of the API exists - the connection information is in the submission email.
The API is not protected by some key, like a x-api-key header. In a proper deployment access should be protected through a key system.
To run this app, the system has to have the following installed and setup:
- MySQL
- Node and npm
- Run
npm installin the root folder of the project to install all dependencies. - Rename
.env.exampleto.envand adjust the information inside. - Ensure that the databases named in
.envexist before starting. - Run the app:
npm startto start the app.npm testto run the tests. The integration tests require access to a test database.
Configure the app by renaming .env.example to .env and editing the information inside.
By default, the app will listen to 127.0.0.1:3000.
Ensure that the databases exist before starting the app or running the tests. Do note, that the database for testing will be cleared of any tables and content during testing.
I made assumptions and implemented reasonable behaviours whenever the user stories don't specify details.
- All email addresses are case-insensitive, but no padding with whitespaces is allowed.
- Teacher and Students are created if they don't exist.
- A Teacher can appear as Students to other Teachers.
- Response status is 400 when there were issues with the arguments.
- All Teachers in the query must exist, or it will return Error 404.
- The Student must exist to be suspended, or it will return Error 404.
- The Teacher must exist, or it will return Error 404.
- Mentioned Students that do not exist are ignored.
The app was made in relatively short time and in limited scope for this assessment. I did not implement or test certain things in order to limit the used time:
- The application does not defend against malicious attacks of any kind beyond basic input sanitation and validation.
- The API does not have any access restrictions (speed, quota, access key).