-
Backend (
jobsRoute.js):- Fixed GET
/jobsto return jobs sorted bypostedDate(newest first). - Added input validation for POST
/jobs:titleis required (non-empty string)salarymust be a number (string numeric values are coerced)- Defaults:
typedefaults tofull-time,postedDatedefaults to today (YYYY-MM-DD)
- Refactored with helper functions:
sortJobsByPostedDateDescandvalidateJobPayloadfor clarity and DRYness.
- Fixed GET
-
Frontend (
JobList.jsx):- Added job type filtering UI (
all,full-time,part-time,remote). - Fixed loading spinner bug by ensuring
setLoading(false)runs in the error path. - Derived
filteredJobsfrom state to keep render logic simple.
- Added job type filtering UI (
postedDatestrings are ISO-like (YYYY-MM-DD) and parseable byDate.- API base is
/apiandjobsRoute.jsis mounted accordingly. - Minimal styling is acceptable for the challenge; focus is on logic and correctness.
- Ensure the Express app uses JSON body parsing (
express.json()) and mounts this router under/api. - Start the server and the frontend as per the host app’s instructions.
- Add a lightweight validation library (e.g.,
zod) to centralize schemas and get better error messages. - Extend filters (search by title, min/max salary) and persist filter state to the URL.
- Add unit tests for router helpers and component behavior (loading/error states and filtering).
- Improve UX: skeleton loaders, retry button on error.