Skip to content

nicolkill/stapi

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stapi

Stapi comes from Static API that helps to generate static files API using a list of ecto schemas from your database and the data it's the moment data snapshot of the schemas.

Installation

If available in Hex, the package can be installed by adding stapi to your list of dependencies in mix.exs:

def deps do
  [
    {:stapi, "~> 0.1.0"}
  ]
end

Usage

The module

To use you need create one module that uses the module Stapi and configure the ecto repo an ecto schemas

defmodule YourApplication.StaticApi do
  use Stapi,
    repo: YourApplication.Repo,  # MANDATORY!
    page_size: 100,              # default: 100
    output: "some_folder",       # default: "generated"
    resources: [
      YourApplication.Products.Product
    ]
end

The task

To generate the API you need run

mix stapi.generate YourApplication.StaticApi

And this will generate folder generated (or the specified in the module)

The structure

:schema/page/:page
:schema/data/:id

About

Database snapshot as static api datasource

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages