bootgs
v1.3.2
Published
Boot Framework for Google Apps Script™ projects.
Maintainers
Readme
Boot Framework for Google Apps Script™
Introduction
Boot.gs is a lightweight framework designed to help build structured Google Apps Script applications. It aims to bring familiar development patterns, such as decorators and dependency injection, to the Apps Script environment to aid in code organization.
Installation
Install the framework via npm:
npm install bootgsQuick Start
1. Define a Controller
Create a class to handle your application's logic. Decorators make it easy to map methods to specific endpoints or events.
import {Get, RestController} from "bootgs";
@RestController("api/sheet")
export class SheetController {
/**
* Handles GET requests to /api/sheet/active-range
*/
@Get("active-range")
getActiveRange(): string {
return "This action returns the active sheet range.";
}
}2. Initialize the Application
Bootstrap your application by creating an App instance and delegating the standard Apps Script entry points (doGet,
doPost) to it.
import {App} from "bootgs";
import {SheetController} from "./SheetController";
/**
* Global entry point for GET requests.
*/
export function doGet(event: GoogleAppsScript.Events.DoGet) {
const app = App.create({
controllers: [SheetController]
});
return app.doGet(event);
}
/**
* Global entry point for POST requests.
*/
export function doPost(event: GoogleAppsScript.Events.DoPost) {
const app = App.create({
controllers: [SheetController]
});
return app.doPost(event);
}Features
- Decorator-based Routing: Intuitive mapping of HTTP and Apps Script events.
- Dependency Injection: Decouple your components for better testability.
- Type Safety: Built with TypeScript for a robust development experience.
- Modern Architecture: Inspired by frameworks like NestJS and Spring Boot.
Decorators
Class decorators
Method decorators
Parameter decorators
Contributing
We welcome contributions! Please see our Contributing Guidelines for details on our code of conduct, and the process for submitting pull requests.
Roadmap
Check out our Roadmap to see what we have planned for future releases.
Changelog
For a detailed list of changes and updates, please refer to the CHANGELOG.
License
This project is licensed under the Apache-2.0 License.
