🚨 Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis →
Socket
Book a DemoInstallSign in
Socket

apache-api

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

apache-api

A simple Apache wrapper for Node.js.

latest
Source
npmnpm
Version
1.2.5
Version published
Maintainers
1
Created
Source

Apache API

A simple Apache wrapper for Node.js.

API Reference

Initialization

You can itialize the API with a special Apache path:

const apacheApi = require('apache-api')('/usr/share/apache2/');

Or with the default one (/etc/apache2/):

const apacheApi = require('apache-api');

Parser

Functions to parse and serialize an Apache configuration file.

const { parser } = require('apache-api');

parser.parse(content, [skipComments]): object

Parse an Apache configuration file.

ParamTypeDescription
contentstringApache configuration file to parse
[skipComments]booleanWether ignore comments. Default: false

parser.serialize(content, [ident], [extendedSpaces]): string

Serialize an Apache configuration file.

ParamTypeDescription
contentobjectConfiguration object to serialize
[ident]stringIndent type. Default: two space
[extendedSpaces]booleanAdd more line returns between instructions. Default: false

Actions

Show Apache status, start, stop, and restart Apache service with systemctl.

const { actions } = require('apache-api');

actions.start(): Promise<any>

Start Apache service.

actions.stop(): Promise<any>

Stop Apache service.

actions.restart(): Promise<any>

Restart Apache service.

actions.status(): Promise<string>

Returns a promise with the Apache service status.

Mods

const { mods } = require('apache-api');

mods.listAvailable(): Promise<string[]>

Show available Apache mods.

mods.listEnabled(): Promise<string[]>

Show enabled Apache mods.

mods.enable(mod): Promise<any>

Enable an Apache mod.

ParamTypeDescription
modstringMod to enable

mods.disable(mod): Promise<any>

Disable an Apache mod.

ParamTypeDescription
modstringMod to disable

Configs

const { configs } = require('apache-api');

configs.listAvailable([sites]): Promise<string[]>

Show available Apache configs.

ParamTypeDescription
sitesbooleanWether to list sites folder

configs.listEnabled([sites]): Promise<string[]>

Show enabled Apache configs.

ParamTypeDescription
sitesbooleanWether to list sites folder

configs.enable(config, [sites]): Promise<any>

Enable an Apache config.

ParamTypeDescription
configstringConfig to enable
sitesbooleanWether to enable sites folder

configs.disable(config, [sites]): Promise<any>

Disable an Apache config.

ParamTypeDescription
configstringConfig to disable
sitesbooleanWether to disable sites folder

configs.readConfig(config, [sites], [parseContent]): Promise<object|string>

Read and parse (optional) a config.

ParamTypeDescription
configstringConfig to read
sitesbooleanWether to use sites folder
parseContentbooleanWether to parse content

configs.saveConfig(config, [sites], [fromParsed]): Promise<any>

Parse (optional) and save a config.

ParamTypeDescription
configobject|stringConfig to save
sitesbooleanWether to use sites folder
fromParsedbooleanWether to parse content

FAQs

Package last updated on 16 Jan 2021

Did you know?

Socket

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