Atma.js Server is a Node.js server module providing a framework for building HTTP applications, leveraging other components within the Atma.js ecosystem like `atma-logger`, `atma-io`, and `appcfg`. It allows for flexible routing, middleware processing (compatible with Connect.js middleware), and resource management for both server-side and client-side assets. The module is currently at version 0.5.30, indicating a pre-1.0 development stage, and is likely in a maintenance or active development phase within its specific ecosystem, rather than a general-purpose, high-cadence release cycle. Key differentiators include its tight integration with Atma.js libraries for configuration, logging, and I/O, and its structured approach to defining application, service, handler, and page endpoints with custom pipelines.
npm install atma-serverVerified import paths — ran on the pinned version, not inferred.
This quickstart initializes an Atma.js server application, configures its base path and configuration file location, and sets up request processing pipelines with `before`, `middleware`, and `after` stages. It includes `body-parser` as a common middleware and the built-in static file handler, then starts the server to listen for incoming requests based on its configuration.
Ensure a build step is in place for production deployments that executes `atma custom node_modules/atma-server/tools/compile` to bundle client-side resources.
Use `import { server } from 'atma-server';` for ESM. For projects strictly enforcing ESM, ensure your `tsconfig.json` and `package.json` (`"type": "module"`) are correctly configured to handle hybrid modules.Verify that your `configs` path in `server.Application` correctly points to your YAML configuration files and that the files themselves are syntactically valid and contain expected keys like `port` and resource definitions.
Prefer `app.listen()` for starting the server to ensure all integrated features, including automatic port discovery from configuration and debug autoreload, function correctly.
Change the `port` setting in your `app.yml` or relevant configuration file, or ensure no other application is using the intended port. You can find and terminate the process using `lsof -i :PORT` (macOS/Linux) or `netstat -ano | findstr :PORT` (Windows).
Ensure the `Application` factory completes successfully before calling `app.processor()`. This typically means waiting for the `.done()` callback to execute. Check for any errors during the `Application` initialization, potentially in your configuration files.
Double-check the `base` and `configs` paths provided to `server.Application`. Ensure they are correct and that the YAML files exist at the specified locations relative to the base path. Use absolute paths for `base` if unsure about relative resolution.