Skip to content
This repository was archived by the owner on Sep 16, 2023. It is now read-only.

balancio/server-v0

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Balancio API Server

REST API server application for Balancio. It's built with Node and Express. For communication with MongoDB database official mongodb driver is used.

Server is currently in prototype phase.

How to run

Prerequisites

  • In root server directory file .env with values for server environment variables
    DB_CONN_CERT="<path-to-mongodb-certificate-file>"
    DB_CONN_URL="<mongodb-connection-url>"
    DB_NAME="<database-name>"
    
    SRV_HOST="<server-host>"
    SRV_PORT="<server-port>"
    
    AUTH_TOKEN_SECRET="<secret-for-signing-auth-token>"

Running server

npm run start

API

User

  • [POST] /users/login
    // Request Body | Login Credentials
    {
        username: string,
        password: string
    }
    // Response Header | Bearer Token
    {
        Authorization: "Bearer <token>",
        ...
    }
  • [POST] /users
    // Request Body | Registration Data
    {
        username: string,
        password: string,
        password_confirm: string,
    }

Wallet

  • [POST] /wallets
    // Request Body | New Wallet object data
    {
        "name": string,
        "currency": string
    }
  • [GET] /wallets/:id
    // Response Body | Wallet object data
    {
        "_id": string,
        "name": string,
        "currency": string,
        "total": number,
        "user_ids": string[] // ref[] -> users
    }
  • [GET] /users/:username/wallets
    // Response Body | Array of Wallet objects
    [
        {
            "_id": string,
            "name": string,
            "currency": string,
            "total": number,
            "user_ids": string[] // ref[] -> users
        },
        ...
    ]

Transaction

  • [POST] /wallets/:id/transactions
    // Request Body | New Transaction object data
    [
        {
            "title": string,
            "date": number, // Unix Time (ms)
            "amount": number
        },
        ...
    ]
  • [GET] /wallets/:id/transactions
    // Response Body | Array of Transaction objects (Sorted by date, descending)
    [
        {
            "_id": string,
            "title": string,
            "date": number, // Unix Time (ms)
            "amount": number,
            "wallet_id": string // ref -> wallets
        },
        ...
    ]

About

Balancio API Server

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published