Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development #3

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
198 changes: 197 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,197 @@
# IP-HCK73
# IP-HCK73

> Deployment Link:

# API Documentation

## Endpoints

List of available endpoints:
- `POST /register`
- `POST /login`
- `POST /auth/google`

Routes below need authentication:
- `GET /user/:id`

- `GET /recipes`
- `POST /recipes`
- `GET /recipes/user`
- `GET /recipes/:id`
- `PUT /recipes/:id`
- `DELETE /recipes/:id`

- `POST /ai`
`

## 1. POST /register
Description:
- Register a new user into the system

#### Request:
- body:
```json
{
"name": "string",
"email": "string",
"password": "string"
}
```

*Response (201 - Created)*
```json
{
"name": "string",
"email": "string",
}
```

*Response (400 - Bad Request)*
```json
{
"message": "Email is required"
}
```
OR
```json
{
"message": "Password is required"
}
```
OR
```json
{
"message": "Validation error message"
}
```

*Response (500 - Internal Server Error)*
```json
{
"message": "Internal server error"
}
```

## 2. POST /login
Description:
- Login into the system

#### Request:
- body:
```json
{
"email": "string",
"password": "string"
}
```

*Response (200 - OK)*
```json
{
"access_token": "string"
}
```

*Response (400 - Bad Request)*
```json
{
"message": "Email is required"
}
```
OR
```json
{
"message": "Password is required"
}
```


*Response (401 - Unauthorized)*
```json
{
"message": "invalid email or password"
}
```

*Response (500 - Internal Server Error)*
```json
{
"message": "Internal server error"
}
```

## 3. POST /auth/google
Description:
- Login into the system using google account

#### Request:
- body:
```json
{
"googleToken": "string"
}
```

*Response (200 - OK)*
```json
{
"access_token": "string"
}
```

*Response (201 - Created)*
```json
{
"access_token": "string"
}
```

*Response (401 - Unauthorized)*
```json
{
"message": "Error authentication"
}
```

*Response (500 - Internal Server Error)*
```json
{
"message": "Internal server error"
}
```
## 4. GET /user/:id
Description:
- Get user info that logged in

- headers:
```json
{
"Authorization": "Bearer <accessToken>"
}
```

*Response (200 - OK)*
```json
{
"id": "number",
"username": "string",
"email": "string",
"password": "string",
"createdAt": "date",
"updatedAt": "date"
}
```

*Response (401 - Unauthorized)*
```json
{
"message": "Error authentication"
}
```

*Response (500 - Internal Server Error)*
```json
{
"message": "Internal server error"
}
```
2 changes: 2 additions & 0 deletions client/client_side/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
VITE_GOOGLE_CLIENT_ID=
VITE_GOOGLE_CLIENT_SECRET=
21 changes: 21 additions & 0 deletions client/client_side/.eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:react-hooks/recommended',
],
ignorePatterns: ['dist', '.eslintrc.cjs'],
parserOptions: { ecmaVersion: 'latest', sourceType: 'module' },
settings: { react: { version: '18.2' } },
plugins: ['react-refresh'],
rules: {
'react/jsx-no-target-blank': 'off',
'react-refresh/only-export-components': [
'warn',
{ allowConstantExport: true },
],
},
}
9 changes: 9 additions & 0 deletions client/client_side/.firebase/hosting.ZGlzdA.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
index.html,1723178560847,13b3b3b170a60699c4404fdaeef089b360f51df880b7fd7536cb281b7b3bb4b1
assets/react-CHdo91hT.svg,1723178560847,1cd6dd18ca8b73ec7518aee45b3597d0d61e8351a87580ab6c4ef3ab6f83ff02
vite.svg,1722311807509,699a02e0e68a579f687d364bbbe7633161244f35af068220aee37b1b33dfb3c7
assets/index-o2_ZuR3o.css,1723178560847,ade7364f263ca533099cd4680b81144508ad79aa83d36dd574eaa09f08c81aa5
assets/IMG_9895-BWThH0u6.jpg,1723178560847,089817541d41640ab0c27e3b36eb4c63e8f576db7bb64c622a6ae5b34393a2d0
assets/3428189_60286-BH2Pf5sy.jpg,1723178560847,533305fe971671a4e3650abb35e60afcd8784d1158409e9faf6d27ac55a23e2a
assets/pngwing.com-x-dqCtpc.png,1723178560847,064908a8ae0948cdb721abbb97d44c7c27ae4d59936bb0c6cca6ee97a092494c
assets/index-Bbt_Ow0k.js,1723178560847,fc178b0d930f09b8803cb267211ea7ccff61e61993103dc7d2b8193a04a26bc1
assets/top-view-food-ingredients-with-veggies-notebook-C45Nfa6e.jpg,1723178560847,83a4d7dab8d8d518641f68f12f21c4a6d0bf847282e298a14cf4fc55e82c1e30
5 changes: 5 additions & 0 deletions client/client_side/.firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "iproject-cb278"
}
}
26 changes: 26 additions & 0 deletions client/client_side/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

.env
8 changes: 8 additions & 0 deletions client/client_side/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# React + Vite

This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.

Currently, two official plugins are available:

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/README.md) uses [Babel](https://babeljs.io/) for Fast Refresh
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
16 changes: 16 additions & 0 deletions client/client_side/firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
8 changes: 8 additions & 0 deletions client/client_side/helper/RequestAPI.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from "axios"

const RequestAPI = axios.create({
// baseURL : "184.73.49.203"
baseURL : "https://api.spoonacular.com"
})

export default RequestAPI
8 changes: 8 additions & 0 deletions client/client_side/helper/RequestRecipe.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import axios from "axios"

const RequestRecipe = axios.create({
baseURL : "https://ip.visionaryvibes.site"
// baseURL : "http://localhost:3000"
})

export default RequestRecipe
16 changes: 16 additions & 0 deletions client/client_side/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React</title>
<script async="" src="https://accounts.google.com/gsi/client"></script>


</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
Loading