Setup your MongoDB Atlas cluster and database. In server/routes/employee.js edit MONGODB_DATABASE and MONGODB_COLLECTION to represent your MongoDB cluster data. Add a new .env file in server folder that fits your MongoDB credentials. For example take a look at server/example.env:
ATLAS_URI = mongodb+srv://<username>:<password>@sandbox.jadwj.mongodb.net/employees?retryWrites=true&w=majority
PORT = 5000
MONGODB_DATABASE = "jacandoAG_assessment"
MONGODB_COLLECTION = "employees"
Make sure that your IP address is whitelisted.
Download Node.js v16+ to run. Install the dependencies and devDependencies and start the server.
cd server
npm i
node server.js
You should get the following message:
Server is running on port: 5000
Successfully connected to MongoDB.
cd client
npm i
npm start
Please develop an application with frontend and backend that allows you to create employees and save them to the database.
- Preferably you use ReactJS but any other Javascript framework or vanilla Javascript is fine too
- There should be input fields for
- first name
- last name
- There should also be a dropdown that lets the user select the gender of the employee
- By clicking the submit button, the data is sent to your backend
- If any of the information is missing, there should be an error message and the data should not be sent to the backend
- Styling is not important but a good design is a plus
- The backend should be written in NodeJS
- Data received from the frontend should be stored in a database
- Preferably you use MongoDB but you can use any you like or even use an in memory store
GNU General Public License v3.0