- Test the API at https://appert-shopping.herokuapp.com/swagger
- Each user is automatically assigned a
cartIdcookie which is used in subsequent requests. - The shopping cart API supports promotions which can be externally configured.
Various instances of
freebieetc can be configured, and new promotion types can be added without modifications to thePromotionsServicecode.
- authorisation - users should be able to (optionally) log in and access the cart they were using anonymously or from a different device.
- checkout & payment
- load/persist to DB, database migration schemas
- atomic DB transactions on take/return item from inventory
- CI/CD pipeline (most supporting scripts are provided)
- Monitor http://localhost:9020/api/health & update to ping DB. If the optional query string
?version=0.0.1does not match the build version a HTTP status409is returned.
docker build -t nalbion/appert-shopping .
docker run --rm -p 9020:9020 nalbion/appert-shoppingAlternatively, use the npm scripts:
npm run docker:build
npm run docker:runWhen running, API documentation is available at http://localhost:9020/swagger. Example requests are provided in the "Try it out" sections.
The schema appert-shopping-api.yml is generated by npm run generate-schema and is also available at http://localhost:9020/swagger/spec.
npm install
npm run test:tddor
npm run start:devIntelliJ users can execute requests from shopping-cart.http
Scripts to run in CI/CD are provided in ci/scripts
- src/api: routes and controllers for api endpoints
- src/models: definitions of data structure
- src/service: contains business logic that may be shared amongst routes
- Need a database? Consider Prisma
- NPM 6
- Typescript
Create an environment (.env) file by copying the (.env.example) and replacing empty variables.
$ npm run lint
$ npm run format
or, do it all together as the pre-commit hook does:
$ npm run format:lint:fix
$ npm test
$ npm run coverage
- Typescript - Typescript transpiler
- Swagger - API Specification (Version 3)
- Mocha - Unit testing framework
- Chai - Unit testing assertions
- Istanbul - Code coverage
- ChanceJS - Values random generator for unit testing
- Open API Generator - Swagger code generation
- Helmet - Security headers