Skip to content

Instantly share code, notes, and snippets.

View EdyVision's full-sized avatar

Eidan Rosado EdyVision

View GitHub Profile
@EdyVision
EdyVision / drugSearchPackage.json
Last active July 8, 2019 01:40
Drug Search Package.json
{
"name": "drug-search-service",
"version": "1.0.0",
"description": "Drug Search Service API code",
"main": "handler.js",
"scripts": {
"start": "sls offline --noAuth",
"test": "SLS_DEBUG=* NODE_ENV=test PORT=9100 ./node_modules/.bin/nyc ./node_modules/.bin/mocha --opts mocha.opts",
"debug": "export SLS_DEBUG=* && node --inspect /usr/local/bin/serverless offline -s dev --noAuth",
"offline": "sls offline start",
@EdyVision
EdyVision / apiUtil.js
Created June 25, 2019 00:41
Drug Search API Util
'use strict';
const axios = require('axios');
exports.submitRequest = async function(url, headers) {
try {
let result = {
statusCode: 500,
data: {}
};
@EdyVision
EdyVision / nlmSearch.js
Created June 25, 2019 00:39
NLM Search Service
'use strict';
const apiUtil = require('../../../common/utils/apiUtil');
const baseRxImageUrl = 'http://rximage.nlm.nih.gov/api/rximage/1';
const nlmDataDiscoveryUrl =
'https://datadiscovery.nlm.nih.gov/resource/crzr-uvwg.json?';
/**
@EdyVision
EdyVision / drugSearchController.js
Created June 25, 2019 00:38
Drug Search Controller
'use strict';
const nlmSearch = require('./services/nlmSearch');
// Headers needed for Locked Down APIs
const headers = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers':
'Origin, X-Requested-With, Content-Type, Accept, X-Api-Key, Authorization',
'Access-Control-Allow-Credentials': 'true'
@EdyVision
EdyVision / drugServiceHandler.js
Created June 25, 2019 00:31
Drug Service Handler File
'use strict';
const drugSearch = require('./functions/drugSearch/drugSearchCtrl');
module.exports.getDrugIdentifiers = async (event) => {
return drugSearch.getDrugIdentifiers(event);
};
@EdyVision
EdyVision / drugServiceServerless.yml
Last active June 25, 2019 21:09
Drug Service Serverless YML File
# Serverless Drug Search Service
service: drug-search-service
provider:
name: aws
runtime: nodejs8.10
stage: ${opt:stage, 'dev'}
region: us-east-1
apiGateway: