Skip to content

Commit

Permalink
added README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkirathe committed Sep 4, 2024
1 parent 7c1bb19 commit 8dfb3ad
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions netlify/functions/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import swaggerUi from 'swagger-ui-express';
import swaggerJsdoc from 'swagger-jsdoc';
import { Server } from 'socket.io';
import http from 'http';
import { swaggerOptions } from 'netlify/functions/swaggerConfig.js';
import { swaggerOptions } from 'swaggerConfig.js';

const index = express();
const port = 3500;
Expand Down Expand Up @@ -66,7 +66,7 @@ index.use('/api-docs', swaggerUi.serve, swaggerUi.setup(specs));
* 401:
* description: Invalid email or password
*/
index.post('/api/signin', (req, res) => {
index.post('/signin', (req, res) => {
const { email, password } = req.body;
const user = users.find((u) => u.email === email && u.password === password);

Expand Down Expand Up @@ -100,7 +100,7 @@ index.post('/api/signin', (req, res) => {
* 409:
* description: User already exists
*/
index.post('/api/signup', (req, res) => {
index.post('/signup', (req, res) => {
const { email, password } = req.body;
const userExists = users.some((u) => u.email === email);

Expand Down Expand Up @@ -129,7 +129,7 @@ index.post('/api/signup', (req, res) => {
* 404:
* description: User not found
*/
index.get('/api/user', (req, res) => {
index.get('/user', (req, res) => {
const authHeader = req.headers.authorization;
if (!authHeader) {
return res.status(401).json({ message: 'Authorization header is missing' });
Expand Down Expand Up @@ -169,7 +169,7 @@ index.get('/api/user', (req, res) => {
* 401:
* description: Invalid refresh token
*/
index.post('/api/refresh', (req, res) => {
index.post('/refresh', (req, res) => {
const { refreshToken } = req.body;
try {
const decoded = jwt.verify(refreshToken, REFRESH_SECRET_KEY);
Expand All @@ -194,7 +194,7 @@ index.post('/api/refresh', (req, res) => {
* 200:
* description: Server is working
*/
index.get('/api/check', (req, res) => {
index.get('/check', (req, res) => {
res.status(200).json({ message: 'All working' });
});

Expand Down

0 comments on commit 8dfb3ad

Please sign in to comment.