-
Notifications
You must be signed in to change notification settings - Fork 3
Creating the API
This library will help you create model-based multi-level APIs.
These APIs are providing endpoints based on the data models you create, so endpoints are (mostly) created automatically, while the data model (entities and relations) will be created by you.
Once you connect your models with relations, your API will become multi-level, so you will be able to query related models using the automatically generated endpoints.
But to create your first API, you must build the project structure first.
API Core is a modular platform built of multiple NPM packages. API Provider is the package which will help you composing your API using the API Core packages. So, first you have to install this package:
$ npm install --save api-providerEvery API must have at least one consumable version. So you have to create a version for your API:
const { ApiProvider } = require('api-provider')
const provider = new ApiProvider(),
api = provider.version('1.0')Congratulations, you have created your first API! :)
The next step is to add your edges. You should create a directory for these:
$ mkdir edgesAnd inform API Provider about it:
api.edgeDir(`${__dirname}/v1.0/edges`)Now you are ready to create your first edge.
Getting started
• 1. Creating the API
• 2. Creating edges
• 3. Creating relations
• 4. Providing the API
• 5. Consuming the API
API Composition
• Edges
• Relations
• Actions, operations
• Custom methods
Providers
• Model providers
• Access providers
• API provider
API Consumption
• Low-level access
• High level access
• Swagger support