This repository contains the code and resources for the "Build Your Own API" course by Angela Yu. The project demonstrates how to create a RESTful API using Node.js and Express.js, and includes a frontend built with HTML, CSS, and EJS.
This project is a RESTful API built using Node.js and Express.js. It includes a frontend created with HTML, CSS, and EJS. The API allows users to perform CRUD (Create, Read, Update, Delete) operations on a dataset. The course by Angela Yu provides a comprehensive guide on how to build this API from scratch, covering fundamental concepts and best practices.
- Create new entries in the dataset
- Retrieve details of existing entries
- Update existing entries
- Delete entries
- Error handling for invalid requests
- Dynamic rendering of data with EJS
- Basic frontend interface with HTML and CSS
To get a local copy up and running, follow these simple steps:
- Clone the repository
https://github.com/anasrehman/Simple-Blog---CRUD.git
- Navigate to the project directory
cd Simple-Blog---CRUD
- Install the required packages
npm install
To run the API locally, use the following command:
node server.js
node index.js
The API will be accessible at http://127.0.0.1:3000
.
Here are the available endpoints for the API:
GET /items
: Retrieve all itemsGET /items/:id
: Retrieve a single item by its IDPOST /items
: Create a new itemPUT /items/:id
: Update an existing item by its IDDELETE /items/:id
: Delete an item by its ID
You can test the API endpoints using Postman:
- Open Postman and create a new request.
- Select the appropriate HTTP method (GET, POST, PUT, DELETE).
- Enter the request URL (e.g.,
http://127.0.0.1:3000/items
). - For POST and PUT requests, select the Body tab and choose raw and JSON format to send data.
- Click Send to see the response.
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have suggestions for improving this project, please fork the repository and create a pull request. You can also simply open an issue with the tag "enhancement".
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
- Angela Yu - For the comprehensive course
- Node.js - The JavaScript runtime used
- Express.js - The web framework used
- Postman - For API testing
- GitHub - For hosting the repository
Feel free to customize this template to better fit your project. Include any additional sections or information specific to your project as needed.