This is a simple REST API that implements authentication using Express, PostgresSQL, JWT, and bcrypt.
-
Clone the repository: github-link
-
Navigate into the project directory:
-
Install the dependencies:
-
Set up your
.envfile with the appropriate values:
- Endpoint:
POST /auth/register - Body:
{ "email": "user@example.com", "password": "password123", "surname": "yourSurname", "name": "New User" }
- Endpoint:
POST /auth/login - Body:
{ "email": "user@example.com", "password": "password123" }
- Endpoint:
GET /protected - Header:
Authorization: Bearer <token> - This route is protected, and requires a valid JWT token for access.