Redis
 sql >> Teknologi Basis Data >  >> NoSQL >> Redis

API E-Commerce Dibuat Dengan Node-Js, TypeScript, PostgreSQL, Redis, dan Kafka

Pengantar

API E-niaga dibuat dengan TypeScript, express, PostgreSQL, Redis &Kafka dengan semua fitur dasar dan banyak lagi !!

Kode Sumber - https://github.com/leoantony72/E-commerce-Api

Variabel lingkungan

PORT = 4000
DB_USER = PGUSER
DB_PASSWORD = PGPASSWORD
DB_HOST = postgresdb
DB_PORT = 5432
DB_DATABASE = e_commerce
SESSION_SECRET = Session Secret
SESSION_MAXAGE = 3600000 * 60 * 10
GMAIL_USER = email // eg:(test123)
GMAIL_PASS = Gmail password
STRIPE_PUBLIC_KEY = Stripe public Key
STRIPE_SECRET_KEY = Stripe Private Key

Bangun buruh pelabuhan

docker-compose up // in the root dir

Siapkan Postgres, Redis &Kafka

*Postgres *

docker exec -it postgresdb psql -U username -W e_commerce

Salin dan tempel file db.sql dari db_model

*Redis *

docker exec -it redis-e-commerce bash -c redis-cli

rekatkan perintah ini

BF.RESERVE usernames 0.00001 10000

Kafka

docker exec -it broker bash
kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1  --partitions 1  --topic orders

Dengan ini, pengaturan kami selesai, semua rute Api adalah


1. /api/store                       GET     Access the Store
2. /api/auth/register               POST    Register a User
3. /api/auth/login                  POST    Login A user
4. /api/auth/logout                 POST    Logout A User
5. /api/auth/forgotpassword         POST    Req For Password Reset
6. /api/auth/reset-password/        POST    Resets The Password
7. /api/verify                      GET     Verify The Email
8. /api/admin/product               POST    Insert A Product
9. /api/admin/product/:id           PUT     Update Product
10. /api/admin/product/:id          DELETE  Delete A Product
11. /api/admin/stock/:id            PUT     Update Stock
12. /api/admin/discount/:pid        GET     Get Discount of a Product
13. /api/admin/add_discount/:id     POST    Add Discount to a product
14. /api/admin/activate/:id         GET     Activate Discount
15. /api/manager/orders             GET     Gets Order
16. /api/manager/order/:orderid     GET     Get Individual Order Detailes
17. /api/shipper/updateorder/:oid   POST    Sents Confirm Order Request
18. /api/order/confirmdelivery      POST    User Confirms Delivery
19. /api/products                   GET     Get Products
20. /api/products/:pid              GET     Get Individual product
21. /api/checkusername              POST    Checks If Username is Taken
22. /api/ratings/:pid               GET     Get Rating
23. /api/ratings/:pid               POST    Add Rating To Product
24. /api/ratings/:pid               PUT     Update Rating
25. /api/ratings/:pid               DELETE  Delete Rating
26. /api/cart                       GET     Get Cart Items
27. /api/addItem/:pid               POST    Add Item To Cart
28. /api/removeItem/:pid            DELETE  DEL Item In Cart
29. /api/purchase                   POST    Purachse Item
30. /api/userAddress                POST    Add User Address
31. /api/userAddress                DELETE  DEL User Address
32. /api/userAddress                PUT     Update User Address

Rincian lebih lanjut tentang rute disediakan dalam dokumentasi 👉

Kode Sumber :https://github.com/leoantony72/E-commerce-Api

Terima kasih atas waktunya...😁


  1. Redis
  2.   
  3. MongoDB
  4.   
  5. Memcached
  6.   
  7. HBase
  8.   
  9. CouchDB
  1. Waktu fungsi Google Cloud habis saat menghubungkan ke Redis di IP internal Compute Engine

  2. Spring RedisTemplate :Serialise beberapa kelas Model ke JSON.Perlu menggunakan Multiple RedisTemplates?

  3. Menerapkan ScaleGrid DBaaS untuk Redis™ di AWS Virtual Private Cloud (VPC)

  4. Algoritma pencocokan pengguna

  5. Apakah ada perintah di Redis untuk struktur data HASH yang mirip dengan MGET?