This is a small nursery management system built with Node.js, Express.js, and MongoDB. It provides endpoints for managing teachers, children, and classes.
- CRUD operations for teachers
- CRUD operations for children
- CRUD operations for classes
- Authentication with JWT tokens
- Input validation for creating and updating resources
- File upload for teacher images
- Clone the repository:
git clone https://github.com/asmaa-elfatayry/Nursery-App
- Install dependencies:
cd Nuersery App
npm install
-
Set up environment variables:
- Create a
.env
file in the root directory - Define the following variables:
PORT
: Port number for the server (default is 3000)MONGODB_URI
: MongoDB connection URIJWT_SECRET
: Secret key for JWT token generation
- Create a
-
Run the application:
npm start
GET /teachers
: Get all teachersPOST /teachers
: Add a new teacherPUT /teachers
: Update an existing teacherDELETE /teachers
: Delete a teacherPUT /teachers/password
: Change the teacher's password
GET /childrens
: Get all childrenPOST /childrens
: Add a new child (Authorization required)PUT /childrens
: Update an existing child (Authorization required)DELETE /childrens
: Delete a child (Authorization required)
GET /classes
: Get all classesPOST /classes
: Add a new classPUT /classes
: Update an existing classDELETE /classes
: Delete a class
- Authentication is required for most endpoints using JWT tokens.
- To authenticate, include the JWT token in the Authorization header of the request.
- Use the
/login
endpoint to obtain a JWT token by providing valid credentials.
- Swagger documentation is not accessible directly as most routes require authorization with a JWT token.