Altis supports running Node.js applications alongside WordPress, utilizing WordPress as a headless API.
Node.js can be enabled in Local Server by adding extra.altis.modules.local-server.nodejs in the project's composer.json
{
"extra":{
"altis":{
"modules":{
"local-server":{
"nodejs":{
"path":"../altis-nodejs-skeleton"
}
}
}
}
}
}path is relative to the directory where composer.json lives.
Similar to configuring the Altis infrastructure, the Local Server determines the Node.js version to use based on the engines.node value found in the package.json at the specified path.
Once configured, the Local Server executes npm run dev inside the Node.js container at the specified path. This command watches for changes and recompiles necessary files.
This setup makes the application accessible at https://nodejs-{project-name}.altis.dev.