// Import your favorite Node.js libraries and the Ampt SDK import axios from 'axios'; import { task } from '@ampt/sdk'; // Write your business logic const fetchData = async () => { const response = await axios.get('https://api.my-saas.com'); // Do something with this data } // Create a 'task' handler const myTask = task('Fetch Sample Data', fetchData) // Schedule it to run every hour myTask.every("1 hour")
// Import the Ampt SDK to give your app super powers import { data } from "@ampt/data"; // Build your Next.js app export default function HomePage({ users }) { return ( <div classname="root"> <h1>Welcome to Ampt!</h1> {users?.map((user) => (<p key={user.id}>{user.name}</p>))} </div> ); } // Access cloud resources with Ampt's built-in interaces export async function getServerSideProps() { const result = (await data.get("user:*", true)); return { props: { users: result.items.map(({ value }) => value) }, }; }
// Import the Ampt HTTP interface import { http } from "@ampt/sdk"; import fastify from "fastify"; const fastifyApp = fastify(); // Build your app fastifyApp.get("/hello", (req, res) => { res.send("Hello fastify!"); }); // Enable http requests http.node.use("/api", fastifyApp);
// astro.config.js import { defineConfig } from "astro/config"; // Import the Ampt connector, and that's it! import ampt from "@ampt/astro"; import svelte from "@astrojs/svelte"; // https://astro.build/config export default defineConfig({ output: "server", integrations: [ampt(), svelte()], });
// Import the Ampt HTTP interface import { http } from "@ampt/sdk"; import express from "express"; const expressApp = express(); // Build your Express app expressApp.get("/hello", (req, res) => { res.send("Hello express!"); }); // Enable http requests http.node.use("/api", expressApp);
// _site/_data/posts.js // Import Ampt interfaces const { data } = require('@ampt/data'); // Generate your static sites using data, params, // and more from your Ampt app module.exports = async function () { return async data.get('posts:*'); };