Extra Horizon
GitHub
  • Extra Horizon Documentation
  • Getting Started
    • Start familiarizing yourself
  • Tutorials
    • Medical Device Tutorial
      • Preparation
      • Build your first prototype
        • Define a data model
        • Configure your workflows
          • Workflow 1: Analyze a measurement
          • Workflow 2: Create & store a PDF report
          • Workflow 3: Send an e-mail
        • Define your permissions
          • Update your schema with user permissions
          • Update your schema with group permissions
        • Build the Front-End
          • Set up oAuth in your backend
          • Demo login page
      • Summary & Wrap up
    • Polysomnography (PSG) Tutorial
    • Retool - Building dashboards Tutorial
  • FAQ
    • General
  • Services
    • Identity and Access Management
      • User service
        • Users
        • Groups
        • Global roles
        • Configuration
      • Auth Service
        • Applications
        • OAuth2
        • OAuth1
        • MFA
        • OpenID Connect
          • Google Cloud
          • Azure ADFS
    • Data Management
      • File Service
      • Data Service
        • Schemas
        • Documents
        • FAQ Data Service
    • Automation
      • Task Service
        • Functions
        • Tasks
        • API Functions
        • Examples
          • Hello world (JS)
          • Hello world (Py)
          • Hello world (Docker)
        • FAQ
      • Dispatchers Service
      • Event Service
        • System Events
    • Communication
      • Notification Service
        • Notifications
        • Settings
      • Mail Service
    • Other
      • Localization Service
        • Language Codes
      • Template Service
        • Localizations
      • Payments Service
        • Subscriptions
        • Stripe
        • iOS App Store
      • Configurations Service
  • API Reference
    • OpenAPI Specifications
    • 📦Changelog
      • Per-service Changelog
    • Postman Reference Collection
  • Tools
    • SDK
    • CLI
    • Control Center
  • Additional Resources
    • Resource Query Language (RQL)
    • Handling Errors
    • GitHub
    • API interaction (Python)
    • Migration guide: Enabling verification request limiting
  • ExH Platform
    • 🙋Support
    • ⏱️Usage and Performance
    • 🗺️Regions
    • ⚖️Cloud Subscription Agreement
    • Security, Privacy & Quality
      • 🔓Security
      • 🇺🇸CFR 21 Part 11
      • ExH as OTS Software
Powered by GitBook
On this page
  • Index.js
  • Deploying with the ExH CLI
  • Tips

Was this helpful?

  1. Services
  2. Automation
  3. Task Service
  4. Examples

Hello world (JS)

PreviousExamplesNextHello world (Py)

Last updated 11 months ago

Was this helpful?

Index.js

First let's create a simple hello-world script. We are creating a function called handler() that we act as the entryPoint of our Function. Our goal is to print a simple "hello world" to the console.

exports.handler(()=>{
    console.log('hello world');
});

If you are using visual studio code, this should look something like this:

Deploying with the ExH CLI

You can deploy it to the task service using the EXH CLI Tool.

exh tasks sync --name hello-world \
   --code= my/directory \
   --entryPoint=index.handler \
   --runtime="nodejs14.x"

To create a function we need to provide:

  • Function name (name)

  • Reference to the directory containing the (built) code (code)

  • The entryPoint in this case our handler function in the index.js file (entryPoint)

  • The runtime needed to run our code (runtime)

Tips

  • When synchronizing your task, make sure that you also include the node_modules directory if necessary

  • Make sure not include any developer dependencies when bundling your task. Otherwise the size of your task might be too big (there is a 10MB limit). You can easily strip developer dependencies by using npm install --production or yarn install --production

You can see a hello-world function has been created in the task service. See the page on how to create a task and run it.

Tasks