Skip to content

Commit

Permalink
update readme, uninstall luxon
Browse files Browse the repository at this point in the history
  • Loading branch information
tdkent committed Jun 26, 2023
1 parent 7db2c9c commit 6a5ed46
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 308 deletions.
280 changes: 42 additions & 238 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,261 +1,65 @@
# ListMaker Backend
# ListMaker

## Codebase
## About

#### Languages
Welcome to the backend codebase of ListMaker, a list-making application begun in February and
launched in June of 2023. ListMaker is in ongoing development, with improvements and new features
planned. Read on for details!

- TypeScript
- Node
[Visit ListMaker](https://mylistmaker.netlify.com)

#### NPM Packages and Libraries Used
## Run

- Express
- Express Validator
- Slugify
- Bcrypt
- Jsonwebtoken
- PG
- Body-parser
### Environment Variables

#### TypeScript Extensions
The following variables are required in `.env` or `.env.local` to run backend server locally:

- Node
- Express
- Bcrypt
- Jsonwebtoken

## Routes

- Note: unless otherwise specified, successful requests will receive a generic response:

```
{ "message": "OK" }
```

### <b>AUTH</b>

#### Register

<b>Request</b>

- Path: `.../auth/register`
- Method: `POST`
- Body:

```
{
"userEmail": string,
"userNickname": string,
"userPassword": string,
}
```

#### Login

<b>Request</b>

- Path: `.../auth/login`
- Method: `POST`
- Body:

```
{
"userEmail": string,
"userPassword": string,
}
```

<b>Response</b>

```
{
"message": "OK",
"user":
{
"userId": number,
"userEmail": string,
"token": string
}
}
PORT = 3001 // or another port aside from 3000
FRONTEND_URL = "http://localhost:3000" // default CRA port
DEV_DB = "http://localhost:5432/<database-name>" // use local Postgres database name
JWT_SECRET = "<secret-string>" // use a custom secret string
GEOCODING_API_KEY = "<api-key>" // requires a Google Geocoding API key
```

### <b>USER</b>

#### Fetch Profile

<b>Request</b>

- Path: `.../user/profile`
- Method: `GET`
- Authorization: `Bearer Token`

<b>Response</b>

```
{
"message": "OK",
"user":
{
"id": number,
"userEmail": string,
"userNickname": string
}
}
```

#### Edit Profile

<b>Request</b>

- Path: `.../user/profile`
- Method: `PATCH`
- Authorization: `Bearer Token`

### <b>LIST</b>

#### Fetch All Lists

<b>Request<b>

- Path: `.../list/fetch`
- Method: `GET`
- Authorization: `Bearer Token`

<b>Response</b>

```
{
"message": "OK",
"lists": [
{
"id": number,
"userId": number,
"name": string,
"slug": string,
"type": string
}
]
}
```

#### Fetch Single List

<b>Request<b>

- Path: `.../list/fetch/:listId`
- Method: `GET`
- Authorization: `Bearer Token`

<b>Response</b>

```
{
"message": "OK",
"list":
{
"id": number,
"userId": number,
"name": string,
"slug": string,
"type": string
}
}
```

#### New List

<b>Request</b>

- Path: `.../list/new`
- Method: `POST`
- Authorization: `Bearer Token`
- Body:

```
{
name: string,
type: string
}
```

#### Edit List

<b>Request</b>

- Path: `.../list/edit/:listId`
- Method: `PATCH`
- Authorization: `Bearer Token`
- Body:

```
{
name: string,
}
```

#### Delete List

<b>Request</b>

- Path: `.../list/delete/:listId`
- Method: `DELETE`
- Authorization: `Bearer Token`

### <b>ITEM</b>

#### New Item

<b>Request</b>

- Path: `.../item/new/:listId`
- Method: `POST`
- Authorization: `Bearer Token`
- Body:

- Type: SHOP

```
{
"name": string
}
```
Note: "isChecked" boolean (default `FALSE`) is automatically applied
### Scripts

#### Edit Item
Production

<b>Request</b>
- `npm run start`: start production server
- `build`: run TypeScript compiler
- `db`: tear down and build database

- Path: `.../item/:listId/:listType/:itemId`
- Method: `PATCH`
- Authorization: `Bearer Token`
- Body:
Heroku

- Type: SHOP
- `postinstall`: executes `npm run build` (see above) when updating remote server with
`git push heroku main`

```
{
"name": string
}
```
Testing

#### Check Item
- `npm run start:dev`: start testing server with nodemon
- `npm run db:dev`: tear down and build database with nodemon
- `tsc -w`: run TypeScript compiler in watch mode

"Check" or "uncheck" items in allowed list types
## Stack

<b>Allowed List Types</b>
### Languages:

- shop
- todo
- `TypeScript`

<b>Request</b>
### Libraries &amp; Frameworks

- Path: `.../item/check/:listId/:listType/:itemId`
- Method: `PATCH`
- Authorization: `Bearer Token`
- `Node`
- `Express`

#### Delete Item
### Node Packages

- Path: `.../item/:listId/:listType/:itemId`
- Method: `DELETE`
- Authorization: `Bearer Token`
- `Axios`
- `bcrypt`
- `body-parser`
- `cors`
- `dotenv`
- `express-validator`
- `jsonwebtoken`
- `node-postgres`
- `slugify`
27 changes: 0 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"express": "^4.18.2",
"express-validator": "^6.15.0",
"jsonwebtoken": "^9.0.0",
"luxon": "^3.3.0",
"pg": "^8.10.0",
"slugify": "^1.6.5",
"typescript": "^5.0.4"
Expand All @@ -37,7 +36,6 @@
"@types/cors": "^2.8.13",
"@types/express": "^4.17.17",
"@types/jsonwebtoken": "^9.0.1",
"@types/luxon": "^3.3.0",
"@types/node": "^18.15.3",
"nodemon": "^2.0.21"
}
Expand Down
Loading

0 comments on commit 6a5ed46

Please sign in to comment.