1.0.0 • Published 4 years ago

wollies-api v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

WooliesX API

API location

http://ec2-54-162-20-102.compute-1.amazonaws.com:3000/api/v1

Installation and development

npm i
npm run dev

Publish API

npm run build
npm run start

Run test

npm run test

API endpoints

URL: http://ec2-54-162-20-102.compute-1.amazonaws.com:3000/api/v1/user

Method: GET

Response:

{
  "name": "Haotian Chang",
  "token": "fe2858e8-409a-4054-b1a9-d11e091e7cb5"
}

URL: http://ec2-54-162-20-102.compute-1.amazonaws.com:3000/api/v1/sort?sortOption=Low

Method: GET

Parameters: sortOption is one of 'Low', 'High', 'Ascending', 'Descending', 'Recommended'

Response:

[
  {
    "name": "Test Product D",
    "price": 5,
    "quantity": 0
  },
  {
    "name": "Test Product C",
    "price": 10.99,
    "quantity": 0
  },
  {
    "name": "Test Product A",
    "price": 99.99,
    "quantity": 0
  },
  {
    "name": "Test Product B",
    "price": 101.99,
    "quantity": 0
  },
  {
    "name": "Test Product F",
    "price": 999999999999,
    "quantity": 0
  }
]

URL: http://ec2-54-162-20-102.compute-1.amazonaws.com:3000/api/v1/trolleyTotal

Response:

[{
    "passed": true,
    "url": "http://ec2-54-162-20-102.compute-1.amazonaws.com:3000/api/v1/trolleyTotal",
    "message": "Trolley total (154.74668765195955) returned correctly."
}, {
    "passed": true,
    "url": "http://ec2-54-162-20-102.compute-1.amazonaws.com:3000/api/v1/trolleyTotal",
    "message": "Trolley total (14) returned correctly."
}]

Technologies used:

Core:
*node.js
*express.js
*ramda.js
*axios

Toolings:
*babel
*eslint
*prettier
*jest

Server:
*AWS EC2
*PM2

Text Editor:
Neovim

Future Improvement

Need more FP concept to control the project structure properly

fp-ts might be an option