This is an online store project with some functionalities.
JSON Server is a lightweight and easy-to-use Node.js tool that simulates a RESTful API using a JSON file as the data source.
api/db.json
is used to fetch data.
The data inside db.json
is taken from the Northwind DB
.
The Northwind database
is a sample database used by Microsoft to demonstrate the features of some of its products, including SQL Server.
Products
and Categories
are used for this project.
- React
- React-Bootstrap
- React-Router-Dom
- TypeScript
- Northwind data
- CartList
- CartSummary
- CategoryList
- Feedback
- NavigationBar
- NotFound
- ProductList
- Register
Clone the repository.
git clone https://github.com/berkesayin/northwind-store.git
Install the dependencies.
npm install
Install JSON Server
npm install -g json-server
api/db.json
file is used here with some Products
and Categories
data.
Locate api
folder at terminal.
cd api
Start JSON Server
json-server --watch db.json
Now if you go to http://localhost:3000/posts/1, you'll get;
{
"id": 1,
"categoryId": 2,
"productName": "Chai",
"quantityPerUnit": "48 - 6 oz jars",
"unitPrice": "24",
"unitsInStock": 53
}
If you go to http://localhost:3000/categories/1, you'll get;
{
"id": 1,
"categoryName": "Beverages",
"seoUrl": "beverages"
}
Locate the root directory at terminal, and start the project.
npm run dev