Basic homemade API to generate CSS gradients - gradapi: "Gradient API"
This is the first API/API server I've developed. It generates JSON responses with values to create gradients in CSS. This project is experimental and not intended for professional applications. This respository contains:
gradapi.js- generates the gradients
index.js- express server to handle API requests
git clone https://github.com/bendotbike/gradapi.git gradapi cd gradapi npm install
All configuration is done in
index.js (@TODO: make seperate config file).
The environment variable
production can be set to
1 to enable production-mode, which controls logging and rate-limiting. Enable dev mode (set
0) for a test
index.html page to be displayed at
This server uses express-rate-limit to rate limit requests. Very basic, as this is designed to be a public API (no authentication). Configure it in
index.js as well.
- All API calls reside under
- All API calls return JSON with values to insert into CSS to create a gradient
- Gradient colors are randomly generated and each API call returns from 2-5 colors
- JSON output formatting?
- Clean up code
- Configuration file
- Refactor file names