Skip to content
This repository was archived by the owner on Feb 26, 2023. It is now read-only.

andypiper/twbadge-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TwBadge-Server

license Twitter Follow

What this is

TwBadges is a simple JSON server that provides data to support Shields.io custom badges for your Open Source README files, to indicate which Twitter API versions or features your project supports.

It can also serve as a example for how you can set up a similar system to support your own shields.io/endpoint badges.

There's no need to run this just in order get use an API version badge - the code is deployed and running on Glitch, and you can just use a snippet of Markdown with the image URLs linked in order to have them show in a README file. Here's an example, in a Gist.

If you are looking for code libraries that support Twitter API v2...

Install and run

To repeat: you do not need to run your own copy of this code, just in order to use one of the badges that the server supports - there's already a deployed version that enables the badges to work. If you want to explore the code and try it out (useful for building your own Shields.io API endpoint to support your own API, or just to learn about json-server), follow the steps below:

Prerequisites

Before you begin, you'll need a Node.js runtime. It was built and is running on Glitch, and should work with Node 12 through 16+ (currently being built and run on Node 16.x)

Installing TwBadge-Server

To install TwBadge-Server, simply clone this repository - the app is not currently packaged in a way intended to be installed from a module repository.

Then, install the dependencies (run inside the project directory):

$ npm install

Running TwBadge-Server

To run TwBadge-Server, follow these steps from the project directory:

$ node server.js

This does two things:

  • uses json-server to serve a read-only JSON API behind <hostname>/badges that delivers each of the individually-named JSON stanzas on <hostname>/badges/<stanza>, suitable for use with the Shields.io Endpoint API for custom badges.
  • uses Express to serve public/index.html as a trivial front end webpage, which lists some available badges.

Contributing to TwBadge-Server

Pull requests are welcomed. The web front-end is pretty simple right now, using the Bulma CSS framework. I don't anticipate that many changes should be needed to the server side of the code, but let me know if you spot any issues.

License

This project uses the Apache License version 2.0.

About

Twitter API version badges, for everyone

Topics

Resources

License

Stars

Watchers

Forks