🚦 SpeedTracker API layer
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
templates
.gitignore
README.md
app.json
config.js
constants.js
index.js
package.json

README.md

API

SpeedTracker API


npm version

Deploy


Running your own API

Pre-requisites

First, you need to install a SpeedTracker dashboard by following steps 1 to 3 from the SpeedTracker documentation page. For configuration, follow the Configuration and Configuration > Profiles sections.

You need to install Node.js, npm and MongoDB.

Installation

  1. Clone this repository in the location you want to run your API instance
git clone git@github.com:speedtracker/speedtracker-api.git
cd speedtracker-api
  1. Run npm install

  2. Create a personal access token in your GitHub account under Settings > Personal access tokens

  • Be sure to check the option public_repo, since this is needed for the API to update and commit new performance data to your public GitHub version.
  1. Create a file called config.{ENVIRONMENT}.json (e.g. config.development.json) with the following structure:
{
  // The port to run the API on (e.g. 8080)
  "port": 1234, 
  
  // Your WebPageTest API key
  "wpt": {
    "key": "abcdefg"
  },
  
  // Your GitHub personal access token
  "githubToken": "abcdefg",
  
  // MongoDB database connection URI
  "database": {
    "uri": "mongodb://localhost:27017/speedtracker"
  }
}

Run

The API instance is ready to run. Run npm start and, assuming you've followed the steps above on your local machine, you can access your API on http://localhost:8080 (or whatever port you chose).

If you see the {"success":false,"error":"INVALID_URL_OR_METHOD"} in your browser, the API is ready to be used. You'll see this message since we didn't supply the full URL the API needs to run a test. To do that, go to:

http://localhost:8080/v1/test/{USERNAME}/{REPOSITORY}/{BRANCH}/{PROFILE}?key={KEY}

And check the documentation page for more information.


License

This project is licensed under the MIT license:

The MIT License (MIT)

Copyright (c) 2017 Eduardo Bouças

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.