Configuration API Documentation

Base Path

/configs

Endpoints

Get Sample Files List

GET /sample

Get the list of predefined sample configuration files.

Response

{
  code: 200,
  data: SAMPLE_FILES  // List of sample files
}

Get Configuration Files List

GET /files

Get list of all available configuration files.

Response

{
  code: 200,
  data: [
    {
      title: string,  // File name
      value: string   // File value
    }
  ]
}

Get File Details

GET /detail

Query Parameters

{
  path: string  // File path
}

Get the content of specified configuration file.

Save Configuration File

POST /save

Request Body

{
  name: string,     // File name
  content: string   // File content
}

Response

{
  code: 200,
  message: "Save successful"
}

Get Specific File

GET /:file

Get the content of a configuration file by its name.

Error Handling

  • All endpoints follow unified error handling mechanism
  • Successful responses return { code: 200, data: ... }
  • Error logging is handled by Winston logger
  • Access to blacklisted files will return 403 error

Notes

  • Parameter validation using celebrate/Joi
  • File operations using fs/promises for async handling
  • Some file paths are restricted by blacklist