Skip to content

Serverless AMP HTML Validator Microservice for AWS Lambda

License

Notifications You must be signed in to change notification settings

uncompiled/amp-validator

Repository files navigation

AMP Validator

Build Status Code Climate

This is a Serverless implementation of the AMPHTML validator.

It uses the official AMPHTML Validator and returns the validation results as a JSON response.

Getting Started

  • npm install -g serverless
  • serverless deploy

Endpoint

GET /validate

PARAMS:

  • url = urlencoded path to an AMP HTML document

Example Responses

Valid AMP HTML:

{
  "url": "https://www.ampproject.org",
  "status": "PASS",
  "errors": []
}

Invalid AMP HTML:

{
  "url": "https://www.google.com",
  "status": "FAIL",
  "errors": [ ... ] // 64 items
}

Invalid URL:

{
  "url": "https://i.am.not.a.website.xyz",
  "status": "FAIL",
  "errors": [
    {
      "severity": "ERROR",
      "message": {
        "name": "RequestError",
        "message": "Error: getaddrinfo ENOTFOUND i.am.not.a.website.xyz",
        "cause": {},
        "error": {},
        "options": {}
      }
    }
  ]
}

Removing the service

serverless remove -v

License

The MIT License (MIT)