Socket
Socket
Sign inDemoInstall

@alterior/platform-nodejs

Package Overview
Dependencies
17
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @alterior/platform-nodejs

Smoother experience for Alterior on Node.js.


Version published
Maintainers
1
Install size
3.98 MB
Created

Readme

Source

@alterior/platform-nodejs

Simplifies idiomatic setup of a Node.js environment for running Alterior applications.

Important note

You must still ensure you enable experimentalDecorators and emitDecoratorMetadata in your tsconfig.json to properly run Alterior applications.

Usage

Within your entry point (usually main.ts):

import '@alterior/platform-nodejs'; // must be first!
import { Application } from '@alterior/runtime';

// other imports here...

Application.bootstrap(MyModule);

Important: Make sure import '@alterior/platform-nodejs'; is the first line in your entrypoint (main.ts).

What does it do?

This does a number of things for you:

  • Loads zone.js as early as possible to ensure all code properly runs within the root Zone.
  • Loads reflect-metadata as early as possible to ensure all subsequently loaded code has Typescript reflection metadata emitted
  • Loads source-map-support/register as early as possible to ensure any stack traces are shown using the available source maps (this avoids seeing compiled JS files in stack traces, instead showing the original source file locations).
  • Loads dotenv/config as early as possible to ensure that any dotenv files are properly accounted for within process.env.
  • Makes fetch() available globally (when not already provided). Does this with globalThis.fetch = require('node-fetch')
  • Makes WebSocket available globally (when not already provided)

Keywords

FAQs

Last updated on 28 Jan 2024

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