saferwall-api

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 6, 2022 License: Apache-2.0

README

saferwall web apis GoDoc Report Card GitHub Workflow Status (branch) codecov

Preface

This repository powers the web service api used in https://saferwall.com.

Vendoring

These packages are used in the project:

Available Endpoints

The following endpoints are available:

Activities

Authentication
Users resource
User resource
User actions
Files resource
File resource
File actions
Comments resource
Comment resource

Rules for mapping HTTP methods to CRUD:

POST   - Create (add record into database)
GET    - Read (get record from the database)
PATCH  - Update (edit record in the database)
PUT    - Replace (replace record in the database)
DELETE - Delete (remove record from the database)

Rules for HTTP status codes:

* Create something            - 201 (Created)
* Read something              - 200 (OK)
* Update something            - 200 (OK)
* Delete something            - 200 (OK)
* Missing request information - 400 (Bad Request)
* Unauthorized operation      - 401 (Unauthorized)
* Any other error             - 500 (Internal Server Error)

Folder Structure

This project follows the Standard Go Project Layout

  • build - contains packaging and Continuous Integration files.
  • cmd - contains the main function.
  • configs - contains configuration file templates or default configs.
  • docs - contains design and user documents.
  • internal - contains project specific packages with dependencies.
  • pkg - contains generic packages without project specific dependencies - these can be safely moved to other projects without internal dependencies.

Improvements compared to the previous implementation

  • clean architecture with solid principles.
  • Full test coverage
  • swagger doc
  • Error handling with proper error response generation
  • details:
    • File{} not depending on peparser.

References

Directories

Path Synopsis
cmd
dbsyncher module
internal
config
Package consumer implements the NSQ worker logic.
Package consumer implements the NSQ worker logic.
db
secure/token
Package token implements `TokenGenerator` for couchbase driver.
Package token implements `TokenGenerator` for couchbase driver.
pkg
log
Package log provides context-aware and structured logging capabilities.
Package log provides context-aware and structured logging capabilities.
pagination
Package pagination provides support for pagination requests and responses.
Package pagination provides support for pagination requests and responses.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL