Skip to content

amavm/amavm-vdh-api

Repository files navigation

amavm-vdh-api

Prerequisites

Local execution

  1. Set up the Amazon AWS CLI with your own credentials.

  2. Ensure you have MongoDB installed and accepting connections. Ensure that the URL in local.config.json matches your MongoDB installation.

  3. Start the local server:

    $ npm start

    This will expose a local server at localhost:3000.

    Note: The console output will give you an API key which you will need to add to the x-api-key header of some requests.

Unit tests

$ npm test
$ npm run test:watch

Deployment

  1. Set all the required parameters in the AWS Parameter Store. You will need to set the following substituting ${environment} for the environment you will be deploying to in step 2:

    • /amavm/vdh-api/${environment}/assets/bucket - the default S3 bucket. Default: amavm-vdh-api-assets
    • /amavm/vdh-api/${environment}/assets/root - the root of the S3 url. e.g. http://amavm-vdh-api-assets.s3-website-us-east-1.amazonaws.com
    • /amavm/vdh-api/${environment}/assets/mongodb-url - the URL of your MongoDB. I think this also needs to include credentials, so you should encrypt this.
    • /amavm/vdh-api/${environment}/assets/mongodb-db - the default MongoDB database. Default: amavm-vdh
    • /amavm/vdh-api/${environment}/assets/mtl-od-bp-url - the URL of the city's bike path file Default: http://donnees.ville.montreal.qc.ca/dataset/5ea29f40-1b5b-4f34-85b3-7c67088ff536/resource/0dc6612a-be66-406b-b2d9-59c9e1c65ebf/download/reseau_cyclable_2018_c.geojson
  2. Run the deploy:

    $ npm run deploy -- [environment]

Run end-to-end tests

$ npm run test:e2e -- --global-var url=[environment url]