Skip to content

juliocesar014/auth-api-user

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

specs

  • Go 1.21
  • Postgresql 12

run in local with docker container

git clone git@github.com:juliocesar014/auth-api-user.git
cd auth-api-user

ps: Create you .env file with DB_URL

docker build -t auth-api-user .
docker run -p 8000:8000 auth-api-user

methods in local

- [GET all users] localhost:8000/users

curl http://localhost:8000/users

- [POST user] localhost:8000/users

curl -X POST -H "Content-Type: application/json" -d '{
  "name": "first name",
  "email": "name@example.com",
  "password": "example#123"
}' http://localhost:8000/users

- [GET users by id] localhost:8000/users/{id}

curl http://localhost:8000/users/1

- [PUT user] localhost:8000/users/{id}

curl -X PUT -H "Content-Type: application/json" -d '{
  "name": "new name",
  "email": "newemail@example.com",
  "password": "newpassword#123"
}' http://localhost:8000/users/1

- [DELETE user] localhost:8000/users/{id}

curl -X DELETE http://localhost:8000/users/1

- [POST login] localhost:8000/login This route is used for user authentication. The client must provide a JSON object containing a valid email and password. If the credentials are correct, the route returns a JWT access token, which can be used to authenticate and authorize the user in other parts of the application.

curl -X POST -H "Content-Type: application/json" -d '{
  "email": "name@example.com",
  "password": "example#123"
}' http://localhost:8000/login

- [GET health status api] localhost:8000/health

curl http://localhost:8000/health

methods in web api

- [GET all users] https://auth-api-user.onrender.com/users

curl http://https://auth-api-user.onrender.com/users

- [POST user] https://auth-api-user.onrender.com/users

curl -X POST -H "Content-Type: application/json" -d '{
  "name": "first name",
  "email": "name@example.com",
  "password": "example#123"
}' http://https://auth-api-user.onrender.com/users

- [GET users by id] https://auth-api-user.onrender.com/users/{id}

curl http://https://auth-api-user.onrender.com/users/1

- [PUT user] https://auth-api-user.onrender.com/users/{id}

curl -X PUT -H "Content-Type: application/json" -d '{
  "name": "new name",
  "email": "newemail@example.com",
  "password": "newpassword#123"
}' http://https://auth-api-user.onrender.com/users/1

- [DELETE user] https://auth-api-user.onrender.com/users/{id}

curl -X DELETE http://https://auth-api-user.onrender.com/users/1

- [POST login] https://auth-api-user.onrender.com/login This route is used for user authentication. The client must provide a JSON object containing a valid email and password. If the credentials are correct, the route returns a JWT access token, which can be used to authenticate and authorize the user in other parts of the application.

curl -X POST -H "Content-Type: application/json" -d '{
  "email": "name@example.com",
  "password": "example#123"
}' http://https://auth-api-user.onrender.com/login

- [GET health status api] https://auth-api-user.onrender.com/health

curl http://https://auth-api-user.onrender.com/health

partial architecture

image

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published