https://github.com/freelancer/comp9322
https://github.com/freelancer/comp9322
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/freelancer/comp9322
- Owner: freelancer
- License: apache-2.0
- Created: 2018-02-15T03:57:00.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-12T11:37:02.000Z (almost 8 years ago)
- Last Synced: 2025-01-11T08:28:51.196Z (about 1 year ago)
- Language: Python
- Size: 87.9 KB
- Stars: 1
- Watchers: 6
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Lab exercises for COMP9322
The overall goal of the following exercises is to demonstrate *service oriented architecture* or *microservices architecture*.
The general idea of this software design pattern is that each service performs a fairly indepedent role and multiple
services together offer one or more user facing functionality. The interaction between these services are usually via one
or a mix of *HTTP* or *Remote Procedure Call*(RPCs). For the labs here, we will be using HTTP.
Our sample web application that we will use to demonstrate the above is a *Today I learned* application which is a
platform to write and share short posts about what users learn everyday. It will be composed of two independent
services. We will only focus on building the HTTP APIs for each service and consider designing any Web User Interface as out of scope for these exercises. The interaction
with these services will be via HTTP clients.
## [Lab 1](./lab-1)
**Goal:** Create a HTTP API backend for handling user management (**auth** service)
- Handle user signup
- Handler user login (token based authentication)
## [Lab 2](./lab-2)
**Goal:** Create a HTTP API backend for the __Today I Learned__ application
- Create new posts
- View posts
## [Lab 3](./lab-3)
**Goal:** Implement basic analytics functionality for the __Today I learned__ application
- API endpoint to return top tags
## General notes
## Programming language
The programming language used for the exercises is *Python 3* and we will be using [pipenv](https://github.com/pypa/pipenv)
for using and managing third party packages.
### API Documentation
We will be using [Open API specification](https://swagger.io/docs/specification/about/) file for documenting our HTTP
API. The documentation will be added to the source as comments in the following form:
```python
""" New User Signup
---
parameters:
- in: "body"
name: "body"
description: "Signup a new User"
required: true
schema:
$ref: "#/definitions/UserSignupRequest"
responses:
400:
description: "Invalid input"
definitions:
UserSignupRequest:
type: "object"
properties:
username:
type: "string"
first_name:
type: "string"
last_name:
type: "string"
email:
type: "string"
password:
type: "string"
"""
...
```
Using [flasgger](https://github.com/rochacbruno/flasgger) when we run the service, the documentation will automatically become available to us at a desginated URL.
## HTTP Clients
We can make HTTP API requests to the service using a HTTP client like [postman](https://www.getpostman.com/), [curl](https://zaiste.net/introduction_to_curl/) or a more friendlier command line client, [httpie](https://httpie.org/).