/quicksilver-api

:postbox: API gateway to Quicksilver (Message Broker) functionality.

Primary LanguageJavaScriptMIT LicenseMIT

Quicksilver-API wercker status

API gateway to Quicksilver (Message Broker) functionality.

Endpoints

Users

Endpoint Functionality Message
POST /user/register User registration user.registration.transactional
POST /user/password User password reset user.password_reset.transactional

Campaigns

Endpoint Functionality Message
POST /campaign/signup Campaign signup campaign.signup.transactional
POST /campaign/reportback Campaign report back campaign.report_back.transactional

Development

Requirements

  • Node.js v4.4
  • Docker with support of Compose file v2 for running dependent services (like RabbitMQ).

Installation

  1. Install dependencies npm install

  2. Create config/local.js file with following settings:

    module.exports = {
       // Northstar.
       northstar: {
         apiBaseURI: 'https://northstar-qa.dosomething.org/v1/users',
         apiKey: '{{ nothstar_access_key }}',
       },
    
       // Phoenix.
       phoenix: {
        baseURI: 'https://staging.beta.dosomething.org/api/v1',
        username: '{{ phoenix_api_user }}',
        password: '{{ phoenix_api_pass }}',
       },
    
      // RabbitMQ.
      amqp: {
        management: {
          username: 'dosomething',
          password: 'dosomething',
          hostname: 'localhost:15672',
          protocol: 'http',
          vhost: 'dosomething',
        },
        connection: {
          user: 'dosomething',
          password: 'dosomething',
          ssl: false,
          host: 'localhost',
          port: 5672,
          vhost: 'dosomething',
        },
      },
    };

### Dependent services
#### Start

1. Make sure Docker is running
2. Run `npm run start-dev-services`

#### Stop

Run `npm run stop-dev-services`.

#### Available services

- `localhost:5672`: RabbitMQ AMQP
- [`localhost:15672`](http://localhost:15672): RabbitMQ management.
  User and password are `dosomething`.

### Running app in development mode

**Important**: Make sure dependent services are up and running.

Watch mode (prefered):
Run `nodemon` to lift up the application and watch for code changes. Application
will be reloaded on any changes in `.js` and `.json` files.

Normal mode:
You can start Sails as usual by running `sails lift` or `npm start`.

## Tests

**Important**: Make sure dependent services are up and running.

To run all of the tests defined in `/test` recursively.

$ npm test


Test and code style coverage uses the following utilities:
- [Mocha](https://www.npmjs.com/package/mocha)
- [Should](https://www.npmjs.com/package/should)
- [Supertest](https://www.npmjs.com/package/supertest)
- [ESLint](http://eslint.org/)