This is a phonebook application built as part of the Full Stack Open course, specifically Chapter 3. The application allows users to store, retrieve, update, and delete contact information.
- RESTful API for managing contacts
- CRUD operations for phonebook entries
- Express.js for backend
- MongoDB for database
- Middleware for error handling and logging
- Node.js
- Express.js
- MongoDB with Mongoose
- dotenv
- morgan (for logging)
- cors
- nodemon (for development)
-
Clone the repository:
git clone https://github.com/yourusername/phonebook-app.git cd phonebook-app -
Install dependencies:
npm install
-
Set up the environment variables:
- Create a
.envfile in the root directory and add the following:PORT=3001 MONGODB_URI=your_mongodb_connection_string
- Create a
-
Start the server:
npm start
Or in development mode:
npm run dev
-
The API will be running at
http://localhost:3001.
GET /api/persons- Get all contactsPOST /api/persons- Add a new contactGET /api/persons/:id- Get a specific contactPUT /api/persons/:id- Update a contactDELETE /api/persons/:id- Delete a contact
Run tests using:
npm testCreated by Jeromy (https://github.com/jxromy) as part of the Full Stack Open course.
This project is licensed under the MIT License.