/sample-accounts

This sample Flask code shows how to create a RESTful API for subordinate resource

Primary LanguagePythonApache License 2.0Apache-2.0

Accounts Service

Build Status License made-with-python

This repository contains sample code for Customer accounts for an e-commerce web site. This shows how to create a REST API with subordinate resources like accounts that have addresses:

Note: This repo has a both a .devcontainer folder and a Vagrantfile for two ways to bring up a development environment.

Development environment setup

Select the appropriate development environment setup. Most students should choose the first one using Docker and Visual Studio Code.

For Spring 2022 forward

If you are taking this course in the Spring of 2022 or later, follow these instructions: Software Development Guide - Spring 2022

For Fall 2021 and earlier

If you are took this course in the Fall of 2021 or earlier, follow these instructions: Software Development Guide - Fall 2021

Information about this repo

These are the RESTful routes for accounts and addresses

Endpoint          Methods  Rule
----------------  -------  -----------------------------------------------------
index             GET      /

list_accounts     GET      /accounts
create_accounts   POST     /accounts
get_accounts      GET      /accounts/<account_id>
update_accounts   PUT      /accounts/<account_id>
delete_accounts   DELETE   /accounts/<account_id>

list_addresses    GET      /accounts/<int:account_id>/addresses
create_addresses  POST     /accounts/<account_id>/addresses
get_addresses     GET      /accounts/<account_id>/addresses/<address_id>
update_addresses  PUT      /accounts/<account_id>/addresses/<address_id>
delete_addresses  DELETE   /accounts/<account_id>/addresses/<address_id>

The test cases have 95% test coverage and can be run with pytest

License

Copyright (c) 2016, 2024 John Rofrano. All rights reserved.

Licensed under the Apache License. See LICENSE

This repository is part of the New York University (NYU) masters class: CSCI-GA.2820-001 DevOps and Agile Methodologies created and taught by John Rofrano, Adjunct Instructor, NYU Courant Institute, Graduate Division, Computer Science, and NYU Stern School of Business.