Skip to content

Commit

Permalink
Merge pull request #1 from Wathfea/develop
Browse files Browse the repository at this point in the history
Testing
  • Loading branch information
Wathfea authored Sep 3, 2024
2 parents 2c7fea5 + d91ef06 commit 3766820
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
12 changes: 6 additions & 6 deletions components/user/user.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ class UserController {
const user = await this.userService.addUser(req.body);
return res.status(201).send(user);
} catch (error) {
if (process.env.NODE_ENV === 'development') {
if (process.env.VERCEL_ENV === 'development') {
return res.status(500).json({
error: 'Internal Server Error',
'msg': error.message,
'stack': error.stack
});
} else {
return res.status(500).json({ error: 'Internal Server Error' });
return res.status(500).json({ error: 'Internal Server Error, bla bla bla' });
}
}
};
Expand All @@ -26,7 +26,7 @@ class UserController {
const users = await this.userService.getUsers();
return res.status(200).send(users);
} catch (error) {
if (process.env.NODE_ENV === 'development') {
if (process.env.VERCEL_ENV === 'development') {
return res.status(500).json({
error: 'Internal Server Error',
'msg': error.message,
Expand All @@ -44,7 +44,7 @@ class UserController {
const user = await this.userService.getUser(Number(id));
return res.status(200).send(user);
} catch (error) {
if (process.env.NODE_ENV === 'development') {
if (process.env.VERCEL_ENV === 'development') {
return res.status(500).json({
error: 'Internal Server Error',
'msg': error.message,
Expand All @@ -70,7 +70,7 @@ class UserController {
const user = await this.userService.getUser(userId);
return res.status(200).send(user);
} catch (error) {
if (process.env.NODE_ENV === 'development') {
if (process.env.VERCEL_ENV === 'development') {
return res.status(500).json({
error: 'Internal Server Error',
'msg': error.message,
Expand All @@ -91,7 +91,7 @@ class UserController {
}
return res.status(200).json({ success: true });
} catch (error) {
if (process.env.NODE_ENV === 'development') {
if (process.env.VERCEL_ENV === 'development') {
return res.status(500).json({
error: 'Internal Server Error',
'msg': error.message,
Expand Down
8 changes: 6 additions & 2 deletions test-api.http
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
### Define the base URL
@BASE_URL = https://server-tribal-digital.vercel.app/
@BASE_URL = https://server-tribal-digital.vercel.app

### POST request to create a new user
POST {{BASE_URL}}/users/register
Expand Down Expand Up @@ -30,4 +30,8 @@ Authorization: Bearer {{auth_token}}
### GET request to get user details
GET {{BASE_URL}}/users/1
Content-Type: application/json
Authorization: Bearer {{auth_token}}
Authorization: Bearer {{auth_token}}

### GET home
GET {{BASE_URL}}
Content-Type: application/json

0 comments on commit 3766820

Please sign in to comment.