Skip to content

Ticketing API . A full scale production grade micro services backend application for selling tickets to attend a sports event built with serveless architecture of Multi-Micro-Service Apps.

Notifications You must be signed in to change notification settings

Ian-Balijawa/Ticketing-Micro-services-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Ticketing API

A full scale production grade micro services backend application for selling tickets to attend a sports event

Architecture of Multi-Service Apps

$ npm install -g typescript

$ cd app
$ mkdir auth
$ npm init -y
$ npm install --save typescript  express @types/express
$ npm install --save-dev ts-node-dev

$ tsc --init
$ npm start

$ cd skaffold
$ skaffold dev


$ minikube --profile my-profile ip
172.17.0.2

$ sudo vi /etc/hosts
#---------------------------------------------------------------------
# Minikube
#---------------------------------------------------------------------
172.17.0.2 ticketing.dev

browser --> https://ticketing.dev/api/users/currentuser



Response Normalization Strategies


01. Creating Route Handlers


02. Scaffolding Routes


03. Adding Validation

$ cd app/auth
$ npm install --save express-validator

04. Handling Validation Errors

$ curl \
--data '{"email":"notValidEmail", "password":"1"}' \
--header "Content-Type: application/json" \
--request POST http://ticketing.dev/api/users/signup \
| python -m json.tool

response:

[
    {
        "location": "body",
        "msg": "Email must be valid",
        "param": "email",
        "value": "notValidEmail"
    },
    {
        "location": "body",
        "msg": "Password must be between 4 and 20 characters",
        "param": "password",
        "value": "1"
    }
]

06. Surprising Complexity Around Errors


07. Other Sources of Errors


08. Solution for Error Handling


09. Building an Error Handling Middleware


10. Communicating More Info to the Error Handler


11. Encoding More Information In an Error


12. Subclassing for Custom Errors


13. Determining Error Type


14. Converting Errors to Responses


15. Moving Logic Into Errors


16. Verifying Our Custom Errors


17. Final Error Related Code


18. How to Define New Custom Errors


19. Uh Oh... Async Error Handling

08. Database Management and Modeling


01. Creating Databases in Kubernetes

$ cd app/auth
$ npm install --save mongoose

$ kubectl get pods
NAME                                     READY   STATUS    RESTARTS   AGE
auth-deployment-5985769fb8-j5k79         1/1     Running   0          57s
auth-mongo-deployment-55d6d9cc49-jrzsc   1/1     Running   0          57s

02. Connecting to MongoDB

$ cd app/auth
$ npm install --save @types/mongoose

03. Understanding the Signup Flow

04. Getting TypeScript and Mongoose to Cooperate


05. Creating the User Model


06. Type Checking User Properties


07. Adding Static Properties to a Model


08. Defining Extra Document Properties


09. What's That Angle Bracket For


10. User Creation


$ curl \
--data '{"email":"marley@example.com", "password":"123456789"}' \
--header "Content-Type: application/json" \
--request POST http://ticketing.dev/api/users/signup \
| python -m json.tool

response:

{
    "__v": 0,
    "_id": "5eb40ea00b8b66048cc1564e",
    "email": "marley@example.com",
    "password": "123456789"
}

11. Proper Error Handling


14. Adding Password Hashing


13. Reminder on Password Hashing


15. Comparing Hashed Password


16. Mongoose Pre-Save Hooks

$ curl \
--data '{"email":"marley1@example.com", "password":"123456789"}' \
--header "Content-Type: application/json" \
--request POST http://ticketing.dev/api/users/signup \
| python -m json.tool

response:

{
    "__v": 0,
    "_id": "5eb4248c1650af0359d5170f",
    "email": "marley1@example.com",
    "password": "8229ab93d0751b4cbd0f396fd8e701e36089fff0d0c848d5617e65cee9eb830fc7619135058815873d24a4adcbd1779cff1c8efec79a38647810e5b14f15ae33.ef63680bfb5151ed"
}




About

Ticketing API . A full scale production grade micro services backend application for selling tickets to attend a sports event built with serveless architecture of Multi-Micro-Service Apps.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published