/Andlar-API

Primary LanguageJavaScript

Andlar API

This is the API based on Node.js which utilizes several libraries such as:

  • serverless
  • aws-sdk
  • dynamodb

Quick Start

  1. First of all, we need to make sure that all prerequisites are installed in order to run the server. Begin installing the following items:
  1. After this components and tools are installed, we need to checkout the code from repository: https://github.com/chrisepm/andlar-api.

  2. Go to the root folder which is where server.js and package.json file are, then download all dependencies included running the command:

    npm install

    This command should download and install all current dependencies:

    aws-sdk      2.518.0
    dynamoose    1.11.0
    uuid         3.3.3
    supertest    4.0.2
    
  3. Finally, go to root folder and execute the command below to deploy the service.:

    sls deploy
    

Run the tests

npm run test

Deploys

  1. If you want to deploy to dev environment, then:

    sls deploy --stage dev
  2. If you want to deploy to prod environment, then:

    sls deploy --stage prod

How to use the API

The following examples can be executed using Postman tool as client. Some of the GETactions that are included in the API can be executed directly in a common browser such as Google Chrome.

Body content or parameters for all POST actions called from the client, should be in the form of json or x-www-form-urlencoded format.

The endpoints should be like this: