Skip to content

Latest commit

 

History

History
72 lines (56 loc) · 1.38 KB

README.md

File metadata and controls

72 lines (56 loc) · 1.38 KB

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)