You'll need Node.js and i recommend that you have installed the Yarn on your computer. With your setup completed, you will need to instal MySQL, and create an empty database called "stocking".
This API can menage a stock system easily, here you can menage (clients, products, providers, sales and supplies). This API can store purchase and sales data of the stock, as well as it can relate the data of buyers and providers with these actions. All the information can be stored and the relations can be done, but... the information is not updated dynamically, e.g. If a purchase is registered, the amount of products that were purchased will not be deducted from the stock, just as the registered supplies do not increase the amounts stored in the product table.
http://localhost:3000/clients/
http://localhost:3000/products/
http://localhost:3000/sales/
http://localhost:3000/providers/
http://localhost:3000/supplies/
This is API is running at port 3000
http://localhost:3000
;
git clone https://github.com/gabriellopes00/Stocking.git
$ cd Stocking
$ cd server
$ yarn install
$ yarn dev
$ cd Stocking
$ cd server
$ npm install
$ npm run dev
http://localhost:3000/clients/
-- localhost:3000/clients/
- In the method
get
, this route return a list with all of the clients registered in the database. - In the method
post
, this route will create a new client, you just need to pass the clients information.
-- localhost:3000/clients/:id
- In method
get
, passing an id as parameter, will return the information of one client, witch have the id, igual the id passed as parameter, including its complete address. - In method
delete
, passing the id of the client, this client will be removed from the database. - In method
put
, you need to pass the id of the client, and the new client's information, and the client will be updated in the database.
- This routes will return the information about the clients, in method get, or an error, with the status code
400
. And if the clients are deleted, updated or created successfully, will be returned status code200
http://localhost:3000/products/
-- http://localhost:3000/products/
- In the method
get
, this route return a list with all of the products registered in the database. - In the method
post
, this route will create a new product, you just need to pass the products information.
-- http://localhost:3000/products/:id
- In method
get
, passing an id as parameter, will return the information of one product, witch have the id, igual the id passed as parameter. - In method
delete
, passing the id of the product, this product will be removed from the database. - In method
put
, you need to pass the id of the product, and the new product's information, and the product will be updated in the database.
- This routes will return the information about the products, in method get, or an error, with the status code
400
. And if the products are deleted, updated or created successfully, will be returned status code200
http://localhost:3000/providers/
-- http://localhost:3000/providers/
- In the method
get
, this route return a list with all of the providers registered in the database. - In the method
post
, this route will create a new provider, you just need to pass the provider information.
-- http://localhost:3000/providers/:id
- In method
get
, passing an id as parameter, will return the information of one providers, witch have the id, igual the id passed as parameter. - In method
delete
, passing the id of the providers, this providers will be removed from the database. - In method
put
, you need to pass the id of the providers, and the new provider's information, and the providers will be updated in the database.
- This routes will return the information about the providers, in method get, or an error, with the status code
400
. And if the providers are deleted, updated or created successfully, will be returned status code200
.
http://localhost:3000/sales/
-- http://localhost:3000/sales/
- In the method
get
, this route return a list with all of the sales registered in the database. - In the method
post
, this route will create a new sale, you just need to pass the sale information.
-- http://localhost:3000/sales/:id
- In method
get
, passing an id as parameter, will return the information of one sale, witch have the id, igual the id passed as parameter. Including the client the released the sale, and the product that was brought. - In method
delete
, passing the id of the sales, this sale will be removed from the database. - In method
put
, you need to pass the id of the sale, and the new sale's information, and the product will be updated in the database.
- This routes will return the information about the sale, in method get, or an error, with the status code
400
. And if the sales are deleted, updated or created successfully, will be returned status code200
http://localhost:3000/supplies/
-- http://localhost:3000/supplies/
- In the method
get
, this route return a list with all of the supplies registered in the database. - In the method
post
, this route will create a new supply, you just need to pass the sale information.
-- http://localhost:3000/supplies/:id
- In method
get
, passing an id as parameter, will return the information of one supply, witch have the id, igual the id passed as parameter. Including the provider the released the supply, and the product that was supplied. - In method
delete
, passing the id of the supplies, this supply will be removed from the database. - In method
put
, you need to pass the id of the supplies, and the new supply's information, and the supply will be updated in the database.
- This routes will return the information about the supply, in method get, or an error, with the status code
400
. And if the supplies are deleted, updated or created successfully, will be returned status code200