git clone [email protected]:andimiya/political-contributions-api.git
cd political-contributions-api
npm install
npm install -g serverless
Get a copy of env.yaml
(currently in 1Password) and place it in the root directory of the application
You'll need Postgres running on your local machine. Once installed, manually create a database contributions_api_db_local
- Once the DB is created you can run npm run db:migrate:local
for migrations
Command | Description |
---|---|
sls offline | Starts a local server you can query on localhost |
sls invoke local --function nameOfFunction | Allows you to run specific functions |
npm run lint | Run ESLint |
npm run lint:fix | Run ESLint and automatically fix problems. |
npm run db:migrate | Run migrations on local database |
npm run typeorm migration:create -- -n NameOfMigration | Create migration file |
npm run db:drop | Drop local database |
To deploy you must have serverless and the aws-cli installed globally.
If you don't already have the it, install the aws-cli tool. Once installed, you'll want to create a AWS Profile on your local machine that can connect to the Macy's AWS account. Access Keys can be found in our 1Password Vault.
You're required to have AWS Credentials to deploy this serverless function
aws configure --profile political-contributions-api-serverless
AWS Access Key ID [None]: [YOUR_ACCESS_KEY]
AWS Secret Access Key [None]: [YOUR_SECRET_ACCESS_KEY]
Default region name [None]: us-west-1
Default output format [None]: json
To deploy all functions & serverless changes
sls deploy --stage {environment}
To deploy a single function
sls deploy function -f function-name --stage {environment}