• Stars
    star
    749
  • Rank 60,575 (Top 2 %)
  • Language
    TypeScript
  • License
    Other
  • Created over 10 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The express middleware for our avatars service

adorable-avatars

Build Status

What is it?

This repository contains the express middleware that can be used to host your own avatars service!

Check out our website for more info on (and an interactive demo of) what this service does.

How do I use it?

First, you'll need the adorable-avatars package:

npm install adorable-avatars --save

Then, use the router middleware within your application:

// your_server.js
import express from 'express';
import avatarsMiddleware from 'adorable-avatars';

const myApp = express();
myApp.use('/myAvatars', avatarsMiddleware);

That's it! Your server now includes the avatars endpoints!

Endpoints

Assuming your server lives at myserver.com, and you've configured the middleware as above, you now have the following endpoints:

  • myserver.com/myAvatars/:id
    • returns an avatar for the provided id.
    • id can be anything (email, username, md5 hash, as long as it's a valid URI)
    • defaults to 400px
  • myserver.com/myAvatars/:size/:id
    • returns an avatar for the provided id at the specified size
    • size cannot exceed 400px
  • myserver.com/myAvatars/face/:eyes/:nose/:mouth/:color/:size?
    • Allows you to generate a custom avatar from the specified parts and color, and size
    • e.g. myserver.com/myAvatars/face/eyes1/nose2/mouth4/DEADBF/300
  • myserver.com/myAvatars/list
    • returns JSON of all valid parts for the custom endpoint above
    • myserver.com/myAvatars/:size?/random
      • returns a random avatar, different each time
      • e.g. myserver.com/myAvatars/300/random

Development

If you're developing locally, you'll first need to bootstrap (assumes nvm):

# use correct node version
nvm use

# install dependencies
npm install

Then, there are several npm scripts that will be useful:

# run the unit tests
npm test

# run both a dev server and eslint
npm run dev

# run a dev server
npm run dev:server

# run eslint
npm run dev:lint

# compile the application
npm run build

Contributing

Please read the contributors' guide

Open-source Contributors

More Repositories

1

theme-itg-flat

A flat theme for Sublime Text that supports both retina and non-retina.
HTML
481
star
2

gridwax

CoffeeScript
85
star
3

itg.zsh-theme

A designer developed zsh prompt
Vim Script
34
star
4

group-dependencies

JavaScript
13
star
5

rivet

Keep your clients and APIs in sync
TypeScript
11
star
6

bloog

JavaScript
8
star
7

hyper-image-cursor

Hyper terminal plugin for a custom image cursor
JavaScript
5
star
8

switchboard-web

Switchboard Multi-Service Chat Client: Built using a modular adapter system that allows you to integrate custom chat protocols with relative ease. Simply follow the 'Adapter Interface Requirements'. Switchboard and the client will handle the rest.
CoffeeScript
4
star
9

generator-spire

JavaScript
4
star
10

ensure-npm

JavaScript
2
star
11

css-state-machine

TypeScript
2
star
12

sublime-theme-maker

Ruby
2
star
13

vikinghug-ptf

Lua
2
star
14

generator-firepit

Node static site starter project Yeoman Generator.
CoffeeScript
2
star
15

beardson.ly

It's a demo
Ruby
1
star
16

skychart

Ruby
1
star
17

frisky

learning sandbox
Ruby
1
star
18

beardchimp

Ruby
1
star
19

hanau

JavaScript
1
star
20

elden_ring_planner

Elixir
1
star
21

sumi-e

TODO: New Name
CSS
1
star
22

run-command

Run synchronous shell commands from within node
JavaScript
1
star
23

itg

My new website
JavaScript
1
star
24

gridwax-site

CSS
1
star
25

atom-itg-flat

CSS
1
star
26

itg.blog

octopress spinnerooney
JavaScript
1
star
27

itsthatguy.github.com

for github pages
1
star
28

typekit-preview

1
star
29

itg.jekyll

1
star
30

jest-json-schema-matchers

JavaScript
1
star
31

align-imports

JavaScript
1
star
32

i18next-webpack-tools

TypeScript
1
star
33

relovely

PHP
1
star
34

bitwise-tests

Seeing the binary and hexadecimal output of bitwise operations is super helpful. Here are some simple functions for doing just that.
1
star
35

switchboard

Switchboard Multi-Service Chat Client: Built using a modular adapter system that allows you to integrate custom chat protocols with relative ease. Simply follow the 'Adapter Interface Requirements'. Switchboard and the client will handle the rest.
JavaScript
1
star
36

graphql-demo

JavaScript
1
star