Skip to content

jamalkaksouri/go-grpc-product-service

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

52b2763487b447e8aa1a5ff403712e19

Installation

$ make proto

Create a new database named product_svc

Running the app

$ make server

Running both services using Makefile

First run API gateway Then run Auth service Then run Product service

Curl commands

Register User

curl --request POST --url http://localhost:3000/auth/register --header 'Content-Type:application/json' --data '{"email": "jamal.kaksouri@gmail.com","password": "
admin"}'

Login User

curl --request POST --url http://localhost:3000/auth/login --header 'Content-Type:application/json' --data '{"email": "jamal.kaksouri@gmail.com","password": "
admin"}'

Create Product

curl --request POST --url http://localhost:3000/product --header 'Authorization: Bearer YOUR_TOKEN' --header 'Content-Type: application/json' --data '{ "name": "Product A", "stock": 5, "price": 15}'

Find One Product

curl --request POST --url http://localhost:3000/product/1 --header 'Authorization: Bearer YOUR_TOKEN'

How to install make command in windows

make is a GNU command so the only way you can get it on Windows is installing a Windows version like the one provided by GNUWin32. Anyway, there are several options for getting that:

The most simple choice is using Chocolatey. First you need to install this package manager. Once installed you simlpy need to install make (you may need to run it in an elevated/admin command prompt) :

choco install make

Other recommended option is installing a Windows Subsystem for Linux (WSL/WSL2), so you'll have a Linux distribution of your choice embedded in Windows 10 where you'll be able to install make, gccand all the tools you need to build C programs.

For older Windows versions (MS Windows 2000 / XP / 2003 / Vista / 2008 / 7 with msvcrt.dll) you can use GNUWin32.

An outdated alternative was MinGw, but the project seems to be abandoned so it's better to go for one of the previous choices.