Skapi
Welcome to Skapi, the serverless backend API service that simplifies your web development.
This guide will walk you through importing the Skapi library into your project, creating a service, and connecting your application to the Skapi server.
Creating a service
- Register for an account at skapi.com.
- Log in and create a new service from your admin page.
Initializing the Skapi library
Skapi is compatible with both vanilla HTML and webpack-based projects (ex. Vue, React, Angular... etc).
You need to import the library using the <script>
tag or install via npm.
For HTML projects
For vanilla HTML projects, you can import Skapi using the script tag.
Add the following script to the head tag of your HTML file:
<script src="https://cdn.jsdelivr.net/npm/skapi-js@latest/dist/skapi.js"></script>
This is what your starter code should look like:
<!DOCTYPE html>
<script src="https://cdn.jsdelivr.net/npm/skapi-js@latest/dist/skapi.js"></script>
<body>
</body>
<script>
const skapi = new Skapi('service_id', 'owner_id');
...
</script>
For webpack projects
To use Skapi in a webpack-based project (such as Vue, React, or Angular), install skapi-js using npm:
$ npm install skapi-js
Then, import the library into your main JavaScript file:
import { Skapi } from 'skapi-js';
const skapi = new Skapi('service_id', 'owner_id');
export { skapi }
Don't forget to replace service_id
and owner_id
with the values provided in your Skapi dashboard.
Obtaining Connection Information
After initializing the Skapi object, you can retrieve information about the current connection by calling the getConnection()
method.
skapi.getConnection().then((c) => {
console.log(c);
});
This method returns a promise
that resolves with an object containing the following properties:
{
email: string;
ip: string;
locale: string;
owner: string;
region: string;
service: string;
timestamp: number;
}
Documentation
For more information, check out our Documentation