A Node.js module that allows you to easily interact with the Glitch API
📖 Documentation | ✨ Examples |
---|
- 99% coverage of the known Glitch API
- Uses TypeScript that provides hints in editor, type checking, etc.
- Supports WebSocket connection to the Glitch editor
- Support for authorization
- Only one dependence:
node-fetch
- Class abstraction
- Works with both API versions
Warning: this module uses unstable API that hasn't been officially released yet. Described only world-open methods from this unofficial site and my researches
Node.js 8.0.0 or newer is required
npm i glitch-api -s
// Require using ES6 syntax
import { Glitch } from 'glitch-api'
// Or using old fancy style
const { Glitch } = require('glitch-api')
// Init main class
const glitch = new Glitch({ token: 'xxx' }) // Put here your Glitch token
const { api } = glitch
// Get a user profile
api.users.get({ id: 1 }).then(user => console.log) // → User
— How do I get Glitch token?
Paste the following code to the browser's console:
(JSON.parse(localStorage.getItem('cachedUser'))).persistentToken
— Why *api-method* is not implemented?
Because I'm also human and I might not have seen the recent changes in Glitch's API. Anyway, PRs are open for anyone :)
— The *api-method* is not working.
It could be that Glitch devs removed the support for that method. Or it's just a my fault. Open a new issue and describe what's happend.
Feel free to open new Pull request or an issue!
Made by jarvis394 with
- VK: @tarnatovski
- git: @jarvis394