在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:madeindjs/market_place_api_6开源软件地址:https://github.com/madeindjs/market_place_api_6开源编程语言:Ruby 99.5%开源软件介绍:Market Place APIThis repository contains application example build into the API on Rails 6 book. This final application will scratch the surface of being a market place where users will be able to place orders, upload products and more. There are plenty of options out there to set up an online store, such as Shopify, Spree or Magento. The purpose of this application is not only to teach you how to build an API with Rails but rather to teach you how to build an evolutive and maintainable API with Rails. That is, improve your current knowledge with Rails. On this journey, you will learn to:
Setupgit clone https://github.com/madeindjs/market_place_api_6
cd market_place_api_6
bundle install
rake db:create
rake db:migrate UsageCreate user curl -X POST -d 'user[email][email protected]' -d 'user[password]=toto1234' localhost:3000/api/v1/users Obtain token curl -X POST -d 'user[email][email protected]' -d 'user[password]=toto1234' localhost:3000/api/v1/tokens Manage product export TKN="eyJhbG...WqaXAcnE" # from /api/v1/tokens
# create
curl -X POST -H "Authorization: $TKN" -d "product[title]=Bag" -d "product[price]=10" localhost:3000/api/v1/products
# update: publish and add stock
curl -X PATCH -H "Authorization: $TKN" -d "product[published]=true" -d "product[quantity]=2" localhost:3000/api/v1/products/19
# list
curl -H "Authorization: $TKN" localhost:3000/api/v1/products
# delete
curl -X DELETE -H "Authorization: $TKN" localhost:3000/api/v1/products/19 Manage order export TKN="eyJhbG...WqaXAcnE" # from /api/v1/tokens
# create
curl -X POST -H "Authorization: $TKN" -d "order[product_ids_and_quantities][][product_id]=20" -d "order[product_ids_and_quantities][][quantity]=1" localhost:3000/api/v1/orders
# list
curl -H "Authorization: $TKN" localhost:3000/api/v1/orders
# show
curl -H "Authorization: $TKN" localhost:3000/api/v1/orders/7 Requirments
|
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论