-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from chriseugenerodriguez/ci-cd
Split Website & API
- Loading branch information
Showing
956 changed files
with
366 additions
and
315 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,23 @@ | ||
import Constants from './constants'; | ||
|
||
export default function errorHandler(err, req, res, next) { | ||
if (!err) { | ||
return res.sendStatus(500); | ||
} | ||
|
||
if (err.response && err.response['status'] !== 500) { | ||
const errorResponse = err.response; | ||
res.status(err.response['status']).json(errorResponse.data); | ||
} else { | ||
const error = { | ||
message: err.message || 'Internal Server Error.', | ||
stack: '', | ||
}; | ||
|
||
if (Constants.envs.development) { | ||
error.stack = err.stack; | ||
} | ||
|
||
res.status((err.response && err.response.status) || 500).json(error); | ||
} | ||
} | ||
import Constants from './constants'; | ||
|
||
export default function errorHandler(err, req, res, next) { | ||
if (!err) { | ||
return res.sendStatus(500); | ||
} | ||
|
||
if (err.response && err.response['status'] !== 500) { | ||
const errorResponse = err.response; | ||
res.status(err.response['status']).json(errorResponse.data); | ||
} else { | ||
const error = { | ||
message: err.message || 'Internal Server Error.', | ||
stack: '', | ||
}; | ||
|
||
if (Constants.envs.development) { | ||
error.stack = err.stack; | ||
} | ||
|
||
res.status((err.response && err.response.status) || 500).json(error); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,29 @@ | ||
import { Router } from 'express'; | ||
|
||
// ROUTES | ||
import MiscRoutes from './routes/misc.route'; | ||
import ListsRoutes from './routes/lists.route'; | ||
import ProductRoutes from './routes/product.route'; | ||
import SearchRoutes from './routes/search.route'; | ||
import TransactionRoutes from './routes/transaction.route'; | ||
import UserRoutes from './routes/user.route'; | ||
import RegisterRoutes from './routes/register.route'; | ||
import errorHandler from './misc/error-handler'; | ||
|
||
// ROUTER | ||
export const routes = Router(); | ||
|
||
// REFERENCE | ||
routes.use('/misc', MiscRoutes); | ||
routes.use('/products', ProductRoutes); | ||
routes.use('/search', SearchRoutes); | ||
routes.use('/users', UserRoutes); | ||
routes.use('/user', UserRoutes); | ||
routes.use('/transactions', TransactionRoutes); | ||
routes.use('/lists', ListsRoutes); | ||
routes.use('/register', RegisterRoutes); | ||
|
||
// ERROR | ||
routes.use(errorHandler); | ||
|
||
export default routes; | ||
import { Router } from 'express'; | ||
|
||
// ROUTES | ||
import MiscRoutes from './routes/misc.route'; | ||
import ListsRoutes from './routes/lists.route'; | ||
import ProductRoutes from './routes/product.route'; | ||
import SearchRoutes from './routes/search.route'; | ||
import TransactionRoutes from './routes/transaction.route'; | ||
import UserRoutes from './routes/user.route'; | ||
import RegisterRoutes from './routes/register.route'; | ||
import errorHandler from './misc/error-handler'; | ||
|
||
// ROUTER | ||
export const routes = Router(); | ||
|
||
// REFERENCE | ||
routes.use('/misc', MiscRoutes); | ||
routes.use('/products', ProductRoutes); | ||
routes.use('/search', SearchRoutes); | ||
routes.use('/users', UserRoutes); | ||
routes.use('/user', UserRoutes); | ||
routes.use('/transactions', TransactionRoutes); | ||
routes.use('/lists', ListsRoutes); | ||
routes.use('/register', RegisterRoutes); | ||
|
||
// ERROR | ||
routes.use(errorHandler); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
import { | ||
Router | ||
} from 'express'; | ||
|
||
import ListAPI from '../functions/lists.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/followed').get(ListAPI.getMostFollowedLists); | ||
routes.route('/viewed').get(ListAPI.getMostViewedProducts); | ||
routes.route('/viewed/:productId').get(ListAPI.getMostViewedProductsID); | ||
routes.route('/watched').get(ListAPI.getMostWatchedLists); | ||
routes.route('/watched/:productId').get(ListAPI.getMostWatchedListsID); | ||
|
||
export default routes; | ||
import { | ||
Router | ||
} from 'express'; | ||
|
||
import ListAPI from '../functions/lists.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/followed').get(ListAPI.getMostFollowedLists); | ||
routes.route('/viewed').get(ListAPI.getMostViewedProducts); | ||
routes.route('/viewed/:productId').get(ListAPI.getMostViewedProductsID); | ||
routes.route('/watched').get(ListAPI.getMostWatchedLists); | ||
routes.route('/watched/:productId').get(ListAPI.getMostWatchedListsID); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import MiscAPI from '../functions/misc.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/categories').get(MiscAPI.getCategories); | ||
|
||
routes.route('/search/:value').get(MiscAPI.search); | ||
|
||
export default routes; | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import MiscAPI from '../functions/misc.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/categories').get(MiscAPI.getCategories); | ||
|
||
routes.route('/search/:value').get(MiscAPI.search); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import ProductsAPI from '../functions/products.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/').get(ProductsAPI.getProducts); | ||
|
||
routes.route('/search').get(ProductsAPI.searchProducts); | ||
|
||
routes.route('/sidebarFilters').get(ProductsAPI.getSidebarFilters); | ||
|
||
routes.route('/:upc').get(ProductsAPI.getProduct); | ||
|
||
// single product | ||
routes.route('/product/details/:productId') | ||
.get(ProductsAPI.getProductDetails); | ||
routes.route('/product/images/:productId') | ||
.get(ProductsAPI.getProductImages); | ||
routes.route('/product/nutrition/:productId') | ||
.get(ProductsAPI.getProductNutrition); | ||
routes.route('/product/vendors/:productId') | ||
.get(ProductsAPI.getProductVendors); | ||
routes.route('/product/overview/:productId') | ||
.get(ProductsAPI.getProductOverview); | ||
routes.route('/product/history/:productId/:time') | ||
.get(ProductsAPI.getProductHistory); | ||
|
||
// product feedback | ||
routes.route('product/feedback').post(ProductsAPI.postFeedback); | ||
|
||
routes.route('/product/get_pricing_plans') | ||
.get(ProductsAPI.getPricingPlans); | ||
|
||
routes.route('/product/postTransactions') | ||
.post(ProductsAPI.postTransaction); | ||
|
||
export default routes; | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import ProductsAPI from '../functions/products.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/').get(ProductsAPI.getProducts); | ||
|
||
routes.route('/search').get(ProductsAPI.searchProducts); | ||
|
||
routes.route('/sidebarFilters').get(ProductsAPI.getSidebarFilters); | ||
|
||
routes.route('/:upc').get(ProductsAPI.getProduct); | ||
|
||
// single product | ||
routes.route('/product/details/:productId') | ||
.get(ProductsAPI.getProductDetails); | ||
routes.route('/product/images/:productId') | ||
.get(ProductsAPI.getProductImages); | ||
routes.route('/product/nutrition/:productId') | ||
.get(ProductsAPI.getProductNutrition); | ||
routes.route('/product/vendors/:productId') | ||
.get(ProductsAPI.getProductVendors); | ||
routes.route('/product/overview/:productId') | ||
.get(ProductsAPI.getProductOverview); | ||
routes.route('/product/history/:productId/:time') | ||
.get(ProductsAPI.getProductHistory); | ||
|
||
// product feedback | ||
routes.route('product/feedback').post(ProductsAPI.postFeedback); | ||
|
||
routes.route('/product/get_pricing_plans') | ||
.get(ProductsAPI.getPricingPlans); | ||
|
||
routes.route('/product/postTransactions') | ||
.post(ProductsAPI.postTransaction); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import RegisterAPI from '../functions/register.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/:phone') | ||
.post(RegisterAPI.registerPhoneNumber); | ||
|
||
export default routes; | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import RegisterAPI from '../functions/register.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/:phone') | ||
.post(RegisterAPI.registerPhoneNumber); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,17 @@ | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import SearchAPI from '../functions/search.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/sidebar').get(SearchAPI.getSearchPageSidebar); | ||
|
||
routes.route('/content').get(SearchAPI.getSearchPageContent); | ||
|
||
routes.route('/url/exists').post(SearchAPI.searchUrlExists); | ||
|
||
// routes.route('/:upc').get(ProductsAPI.getProduct); | ||
|
||
export default routes; | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import SearchAPI from '../functions/search.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/sidebar').get(SearchAPI.getSearchPageSidebar); | ||
|
||
routes.route('/content').get(SearchAPI.getSearchPageContent); | ||
|
||
routes.route('/url/exists').post(SearchAPI.searchUrlExists); | ||
|
||
// routes.route('/:upc').get(ProductsAPI.getProduct); | ||
|
||
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import TransactionsAPI from '../functions/transactions.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/:uid') | ||
.get(TransactionsAPI.getTransactions) | ||
.post(TransactionsAPI.postTransaction); | ||
|
||
routes.route('/:uid/:tid') | ||
.get(TransactionsAPI.getTransaction) | ||
.put(TransactionsAPI.updateTransaction); | ||
|
||
routes.route('/transaction/get_pricing_plans') | ||
.get(TransactionsAPI.getPricingPlans); | ||
|
||
// routes.route('/get_pricing_plans') | ||
// .get(function(req, res, next){ | ||
// console.log('Hello'); | ||
// }); | ||
|
||
export default routes; | ||
import { | ||
Router, | ||
} from 'express'; | ||
|
||
import TransactionsAPI from '../functions/transactions.functions'; | ||
|
||
const routes = Router(); | ||
|
||
routes.route('/:uid') | ||
.get(TransactionsAPI.getTransactions) | ||
.post(TransactionsAPI.postTransaction); | ||
|
||
routes.route('/:uid/:tid') | ||
.get(TransactionsAPI.getTransaction) | ||
.put(TransactionsAPI.updateTransaction); | ||
|
||
routes.route('/transaction/get_pricing_plans') | ||
.get(TransactionsAPI.getPricingPlans); | ||
|
||
// routes.route('/get_pricing_plans') | ||
// .get(function(req, res, next){ | ||
// console.log('Hello'); | ||
// }); | ||
|
||
export default routes; |
Oops, something went wrong.