Skip to content

Seamlessly integrate frontend and backend, making importing backend code on the frontend possible, convenient and secure.

Notifications You must be signed in to change notification settings

MZanggl/seamlessly

Repository files navigation

seamlessly

Seamlessly integrate frontend and backend, making importing backend code on the frontend possible, convenient and secure.

import { getCurrentUser } from '../api/Actions/users.js'

getCurrentUser().then(user => {
  document.getElementById('app').innerHTML = JSON.stringify(user)
})

npm install seamlessly

Get Started

  1. Copy .seamlessyrc.json to your working directory.
cp node_modules/seamlessly/.seamlesslyrc.json ./
  1. Choose a loader from the "loaders" folder and follow the respective README for the frontend integration.

  2. Choose a backend integration from the "api-generators" folder and follow the respective README.

Examples

Creating a plugin

How to create an API generator

  1. Construct an API the user can inject into his routes file to create the routes, allow an option to pass in the rcPath (path of seamlesslyrc.json) as well as the actionsPath (path where the actions live).

  2. Loop through all files in the actions folder and create a POST route for each, then write the generated routes to .seamlesslyrc.json

{
  "method": "POST", // currently always POST, subject to change
  "endpoint": "<file name without path and extension + function name>",
  "file": "<file name without path, but with extension>",
  "id": "<function name>" // will be used as client function name
}
  1. The request for each route will receive an array named args in its payload. Call the actual function using the spread array.

  2. Each route must return the following JSON format:

{
  "result": "<actual result of function>"
}

About

Seamlessly integrate frontend and backend, making importing backend code on the frontend possible, convenient and secure.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published