https://github.com/herdiansc/falcon-rest-api
An example of a REST api using falcon
https://github.com/herdiansc/falcon-rest-api
falcon rest-api
Last synced: 10 months ago
JSON representation
An example of a REST api using falcon
- Host: GitHub
- URL: https://github.com/herdiansc/falcon-rest-api
- Owner: herdiansc
- Created: 2020-06-14T03:28:22.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-17T00:03:39.000Z (about 2 years ago)
- Last Synced: 2024-04-17T06:31:40.243Z (about 2 years ago)
- Topics: falcon, rest-api
- Language: Python
- Size: 252 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Falcon REST API
This is an ecample project of a rest api server built with falcon.
## Features
- Contains 2 resources: users and clothes
- Contains CRUD for each resource
- Demontrates simple authentication using JWT
- [EXPERIMENTAL] Demontrates upload image
- Acceptance test
- [TBD] Unit test
- Docker containerization
## How to Run
Run this project using docker:
- `docker-compose up --build` to build the project
- `docker-compose start` to start the project
- access `http://localhost:9000/[resource]` where `resource` is either `users|clothes`
## Example request
- Uses jwt token, here is an example of a valid jwt token: `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiYiJ9.jiMyrsmD8AoHWeQgmxZ5yq8z0lXS67_QGs52AzC8Ru8`
- Get users: `curl -XGET -H "Content-type: application/json;" -H "Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiYiJ9.jiMyrsmD8AoHWeQgmxZ5yq8z0lXS67_QGs52AzC8Ru8" 'http://localhost:9000/users'`
- Add clothe: `curl -XPOST -H "Content-type: application/json" -H "Token: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJhIjoiYiJ9.jiMyrsmD8AoHWeQgmxZ5yq8z0lXS67_QGs52AzC8Ru8" -d '{"name":"herdian","email":"herdian@mail.com","size":"S"}' 'http://localhost:9000/clothes'`
# Running Tests
- Go to project root directory
- Run `py.test app/tests/ -vv`
- Screenshot of the test result:
