GithubHelp home page GithubHelp logo

mshehu5 / lighthouse-reporter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vczb/lighthouse-reporter

0.0 0.0 0.0 19 KB

Generate lighthouse reports and save it in a mongo database.

License: MIT License

TypeScript 100.00%

lighthouse-reporter's Introduction

Lighthouse reporter

Generate lighthouse reports and save it in a mongo database.


Get started

Install all dependencies

  yarn install

Add the .env variables

DB_URL=mongodb://<db_user>:<db_pass>@localhost:27017/<db_name>
DB_URL_DEV=mongodb://<db_user_dev>:<db_pass_dev>@localhost:27017/<db_name_dev>
SECRET_KEY=lr-secret-key

Run the project

  yarn dev

API doc:

Sign up

  • Method: POST
  • URL: /api/signup
  • Header: Content-Type: application/json
  • Body:
    {
      "email": "[email protected]",
      "password": "123456"
    }
  • Reponse:
    {
      "message": "User was registered successfully!",
      "user": {
        "id": "6311481641a03f4a480263ad",
        "email": "[email protected]"
      }
    }

Sign in

  • Method: POST
  • URL: /api/signin
  • Header: Content-Type: application/json
  • Body:
    {
      "email": "[email protected]",
      "password": "123456"
    }
  • Reponse:
    {
      "email": "[email protected]",
      "accessToken": "xxYYYxxYYxyxYXyy"
    }

Create trigger

  • Method: POST
  • URL: /api/trigger/create
  • Header:
    • Content-Type: application/json
    • x-access-token: XxxXXXXXxx
  • Body:
    {
      "name": "site",
      "pages": ["https://vczb.github.io/", "https://vczb.github.io/about"]
    }
  • Reponse:
    {
      "message": "Trigger was create successfully!",
      "trigger": {
        "user": "63101417561a7dcc826ff500",
        "name": "site",
        "pages": ["https://vczb.github.io/", "https://vczb.github.io/about"],
        "_id": "631148f641a03f4a480263b0",
        "__v": 0
      }
    }

Dispatch trigger

  • Method: POST
  • URL: /api/trigger/dispatch
  • Header:
    • Content-Type: application/json
    • x-access-token: XxxXXXXXxx
  • Body:
    {
      "name": "site"
    }
  • Reponse:
    {
      "ok": true,
      "message": "Trigger was dispatched successfully"
    }

Show trigger

  • Method: GET
  • URL: /api/trigger/show
  • Header:
    • Content-Type: application/json
    • x-access-token: XxxXXXXXxx
  • Reponse:
    {
      "trigger": [
        {
          "_id": "631017c73b928313f888e557",
          "user": "63101417561a7dcc826ff500",
          "name": "github",
          "pages": ["https://github.com/vczb"],
          "__v": 0
        },
        {
          "_id": "631142fb90071b61f7cf50c9",
          "user": "63101417561a7dcc826ff500",
          "name": "site",
          "pages": ["https://vczb.github.io/", "https://vczb.github.io/about"],
          "__v": 0
        }
      ]
    }

Show report

  • Method: GET
  • URL: /api/report/show?name=<TRIGGER-NAME>
  • Header:
    • Content-Type: application/json
    • x-access-token: XxxXXXXXxx
  • Reponse:
    {
      "report": [
        {
          "_id": "631143d30b4556af51696e53",
          "user": "63101417561a7dcc826ff500",
          "name": "site",
          "data": [
            {
              "url": "https://vczb.github.io/",
              "accessibility": "78",
              "best": "92",
              "performance": "97",
              "pwa": "30",
              "seo": "100",
              "_id": "631143d30b4556af51696e54"
            },
            {
              "url": "https://vczb.github.io/about",
              "accessibility": "67",
              "best": "92",
              "performance": "93",
              "pwa": "20",
              "seo": "100",
              "_id": "631143d30b4556af51696e55"
            }
          ],
          "createdAt": "2022-09-01T23:44:19.969Z",
          "updatedAt": "2022-09-01T23:44:19.969Z",
          "__v": 0
        }
      ]
    }

Contributing

You can contribute to this project by opening an issue or creating a pull request.

License

This project is licensed under the MIT License.

lighthouse-reporter's People

Contributors

vczb avatar mshehu5 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.