Skip to content

Commit

Permalink
updating readme
Browse files Browse the repository at this point in the history
  • Loading branch information
fauzan-radji committed Dec 16, 2023
1 parent 18f23de commit 1f8122f
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
node_modules/
data/
38 changes: 35 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,44 @@ This is a dummy backend for [Ingridentify android app](https://github.com/Ingrid
npm start
```

6. The server should be running on `http://localhost:3000`

## Endpoints

The default port is `3000`, but can be changed by setting the `PORT` environment variable.

### Auth

| Method | Endpoint | Description | Body | Response |
| ------ | ----------- | ----------- | ----------------------------------- | ----------------- |
| POST | /auth/login | Login User | { email: string, password: string } | { token: string } |
#### Login

```http
POST /auth/login
```

##### Request body

| Parameter | Type | Required |
| --------- | ------ | ------------------ |
| email | string | :white_check_mark: |
| password | string | :white_check_mark: |

##### Response

###### Success

```json
{
"name": "Fauzan",
"username": "fauzan",
"email": "fauzan@email.com",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9"
}
```

###### Error

```json
{
"message": "Invalid email or password"
}
```
4 changes: 2 additions & 2 deletions seed.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ User.create({
username: "fauzan",
email: "fauzan@email.com",
password: "12345678",
token: "fauzan-fauzan@email.com-12345678",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
});

User.create({
name: "Hanif",
username: "hanif",
email: "hanif@email.com",
password: "12345678",
token: "hanif-hanif@email.com-12345678",
token: "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
});

0 comments on commit 1f8122f

Please sign in to comment.