0.3.4 • Published 6 years ago

@dreipol/default-api-interfaces v0.3.4

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

default-api-interfaces

This repo shows some default data structure for the APIs.

Folder Structure

src/interfaces/api API for data that is coming from the CMS

src/interfaces/cms Interfaces that represent data coming from the backend/cms

src/interfaces/app Some global interface used by the app structure

src/interfaces/router All Vue routing related interfaces

Guide for adding a new interface

Definitions

Extend framework interface

If you have to extends for example the IRouteData interface that is already given from the framework you can do it like this

export {IData} from '@dreipol/default-api-interfaces';

export interface IAppRouteData extends IData {
    isHeaderColorPrimary: boolean;
}

Group properties

Group properties together. Seperate primitives and non-primitives props for better readability

DO

export interface IProduct {
    name: string;
    color: string;
    abstract: string;
    
    product_image: IImage;
    product_logo: IImage;
    specs: IProductSpecs
    link: ILink;
}

DON'T

export interface IProduct {
    name: string;
    product_logo: IImage;
    specs: IProductSpecs
    color: string;
    product_image: IImage;
    abstract: string;
    link: ILink;
}

Use primitive types

DO Use primitve types like string, or number

export interface IImage {
    url: string;
    alt: string;
}

DON'T - Do not use the type String or Number

export interface IImage {
    url: String;
    alt: String;
}

What a default response should look like

Interface

{
    "data": {
        "containers": {
            "main": {
                "type": "cmp-main",
                "plugins": [...]
            }
        },
        "meta": {
            "title": "Cas Study #2",
            "description": ""
        }
    }
}
0.3.4

6 years ago

0.3.3

6 years ago

0.3.2

6 years ago

0.3.1

6 years ago

0.3.0

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.0

6 years ago

0.0.13

6 years ago

0.0.12

6 years ago

0.0.11

6 years ago

0.0.10

6 years ago

0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago