The express middleware for our avatars service
The express middleware for our avatars service
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.
First, you'll need the adorable-avatars package:
npm install adorable-avatars --saveThen, 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!
Assuming your server lives at myserver.com, and you've configured the middleware as above, you now have the following endpoints:
myserver.com/myAvatars/:idid.id can be anything (email, username, md5 hash, as long as it's a valid URI)myserver.com/myAvatars/:size/:idid at the specified sizemyserver.com/myAvatars/face/:eyes/:nose/:mouth/:color/:size?myserver.com/myAvatars/face/eyes1/nose2/mouth4/DEADBF/300myserver.com/myAvatars/listmyserver.com/myAvatars/:size?/randommyserver.com/myAvatars/300/randomIf you're developing locally, you'll first need to bootstrap (assumes nvm):
# use correct node version
nvm use
# install dependencies
npm installThen, 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 buildPlease read the contributors' guide
No open issues yet, or sync has not completed.