Skip to content

Instantly share code, notes, and snippets.

@objectiveSee
Created March 21, 2017 16:04
Show Gist options
  • Save objectiveSee/bef35b576002e2092177924dd76788cc to your computer and use it in GitHub Desktop.
Save objectiveSee/bef35b576002e2092177924dd76788cc to your computer and use it in GitHub Desktop.
/**
____ _ ____ ____ ____
/ ___| / \ | _ \ | _ \ / ___|
| | / _ \ | |_) | | | | | \___ \
| |___ / ___ \ | _ < | |_| | ___) |
\____| /_/ \_\ |_| \_\ |____/ |____/
*/
app.get('/cards', function (req, res) {
AdminAPI.getCards(req);
});
/**
____ ____ ___ ____ _ _ ____ _____ ____
| _ \ | _ \ / _ \ | _ \ | | | | / ___| |_ _| / ___|
| |_) | | |_) | | | | | | | | | | | | | | | | | \___ \
| __/ | _ < | |_| | | |_| | | |_| | | |___ | | ___) |
|_| |_| \_\ \___/ |____/ \___/ \____| |_| |____/
*/
app.get('/all_products', function (req, res) {
AdminAPI.getAllProducts(req);
});
app.get('/product/:object_id', function (req, res) {
// Logger.info('GET params debug '+JSON.stringify(req.params));
AdminAPI.getProduct(hackParams(req));
});
app.post('/product', function (req, res) {
AdminAPI.postProduct(req);
});
app.put('/product/:object_id', function (req, res) {
AdminAPI.putProduct(hackParams(req));
});
app.delete('/product/:object_id', function (req, res) {
AdminAPI.deleteProduct(hackParams(req));
});
/**
____ _ _____ _ _ ___ ____ ____
/ ___| / \ |_ _| / \ | | / _ \ / ___| / ___|
| | / _ \ | | / _ \ | | | | | | | | _ \___ \
| |___ / ___ \ | | / ___ \ | |___ | |_| | | |_| | ___) |
\____| /_/ \_\ |_| /_/ \_\ |_____| \___/ \____| |____/
*/
app.get('/store_catalogs', function (req, res) {
AdminAPI.getStoreCatalogs(req);
});
app.get('/store_catalog/:object_id', function (req, res) {
// Logger.info('GET params debug '+JSON.stringify(req.params));
AdminAPI.getStoreCatalog(hackParams(req));
});
app.post('/store_catalog', function (req, res) {
AdminAPI.postStoreCatalog(req);
});
app.put('/store_catalog/:object_id', function (req, res) {
AdminAPI.putStoreCatalog(hackParams(req));
});
/**
____ ____ ___ __ __ ___ ____
| _ \ | _ \ / _ \ | \/ | / _ \ / ___|
| |_) | | |_) | | | | | | |\/| | | | | | \___ \
| __/ | _ < | |_| | | | | | | |_| | ___) |
|_| |_| \_\ \___/ |_| |_| \___/ |____/
*/
app.get('/admin_promos', function (req, res) {
AdminAPI.getPromos(req);
});
app.get('/admin_promo/:object_id', function (req, res) {
// Logger.info('GET params debug '+JSON.stringify(req.params));
AdminAPI.getPromo(hackParams(req));
});
app.post('/admin_promo', function (req, res) {
AdminAPI.postPromo(req);
});
app.put('/admin_promo/:object_id', function (req, res) {
AdminAPI.putPromo(hackParams(req));
});
/**
╭━━━┳━━━━┳━━━┳━━━━┳╮╱╭┳━━━╮
┃╭━╮┃╭╮╭╮┃╭━╮┃╭╮╭╮┃┃╱┃┃╭━╮┃
┃╰━━╋╯┃┃╰┫┃╱┃┣╯┃┃╰┫┃╱┃┃╰━━╮
╰━━╮┃╱┃┃╱┃╰━╯┃╱┃┃╱┃┃╱┃┣━━╮┃
┃╰━╯┃╱┃┃╱┃╭━╮┃╱┃┃╱┃╰━╯┃╰━╯┃
╰━━━╯╱╰╯╱╰╯╱╰╯╱╰╯╱╰━━━┻━━━╯
*/
app.get('/status_check', function (req, res) {
// do a health check.
StatusCheck(function(error, response) {
if ( error ) {
req.onError(error);
} else {
req.onSuccess(response);
}
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment