AirCodeLabs Hydrogen Save

The serverless framework creates web servers that can run anywhere.

Project README

Hydrogen

ζœͺζ ‡ι’˜-3

The serverless framework creates web servers that can run anywhere.

Features

  • πŸ‡ Rapid development with Hot Module Replacement (HMR) πŸ”₯
  • πŸ“¦ Supports CommonJS (.js .cjs), ES modules (.mjs), and TypeScript (.ts) functions out of the box.
  • 🧸 Requires almost zero configurations.
  • πŸ—„οΈ Comes with a built-in, ready-to-use text database and file API.
  • πŸ“ Follows intuitive directory structure conventions.
  • 🀏 Written in Pure JavaScript with a sleek and minimalist design.
  • ⚑️ Optimized for runtime performance, regardless of development or production environments.
  • 🧊 Compatible and capable of running your app seamlessly on the AirCode platform.

Getting Started

  1. Create an aircode app
npx create-aircode-app@latest my-aircode-app && cd my-aircode-app
  1. Install dependencies and run
npm i && npm start

Directory Structure

The default project directory structure is very simple.

β”œβ”€β”€functions # put your function api here.
β”‚Β  └── hello.js # http://localhost:3000/hello
β”œβ”€β”€public # put your static resources here.
β”‚Β  └── favicon.ico # http://localhost:3000/public/favicon.ico
└── package.json

Build Cloud Functions

You can easily build your function api in ./functions directory.

  1. With *.js or *.cjs
// myfun.js
const aircode = require('aircode');

module.exports = async function(params, context) {
  console.log('Received params:', params);
  return {
    message: 'Hi, AirCode.'
  };
}
  1. Or with *.mjs
import aircode from 'aircode';

export default async function (params, context) {
  console.log('Received params:', params);
  return {
    message: 'Hi, AirCode.',
  };
};
  1. Or with *.ts
import aircode from 'aircode';

export default async function (params: any, context: any) {
  console.log('Received params:', params);
  return {
    message: 'Hi, AirCode.',
  };
};

Simply visit your built functions with http://localhost:3000/<your_func_name>.

And visit your static resources with http://localhost:3000/public/<your_static_file>.

Documentation

Configurations

There are a few options that you can pass through process.env.

process.env.AC_FAAS_ROOT = process.env.AC_FAAS_ROOT || 'functions';
process.env.AC_PUBLIC_DIR = process.env.AC_PUBLIC_DIR || 'public';
process.env.AC_PORT = process.env.AC_PORT || 3000;

Integration

Integration Hydrogen with AirCode online

Open Source Agenda is not affiliated with "AirCodeLabs Hydrogen" Project. README Source: aircodelabs/Hydrogen
Stars
132
Open Issues
2
Last Commit
6 months ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating