Socket
Socket
Sign inDemoInstall

@aircodelabs/hydrogen

Package Overview
Dependencies
269
Maintainers
4
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @aircodelabs/hydrogen


Version published
Maintainers
4
Install size
15.6 MB
Created

Readme

Source

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

  • Cloud Function
  • The Database
  • The File API

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

FAQs

Last updated on 12 Sep 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc