This project handles the REST calls made by the AvatR application.
- You must have
npminstalled on your machine in order to run the project.npm install npm@latest -g
-
Clone the repo
git clone https://github.com/zanzarone/avatr-api.git
-
Enter in the project directory
cd avatr-api -
Install NPM packages
npm install
-
Create an
.envfile in the root of the project with this enviroment variables:NODE_ENV = ""; //'production' or 'development' PORT = ""; // port number where the server will listen DEV_ORIGIN = ""; // string for allowed origin on development; REMOTE_ORIGIN = ""; //string for allowed origin on production;
Run:
npm run devto star the service in development mode ornpm startto star the service in production mode
| HTTP Method | Endpoints | Action | Params |
|---|---|---|---|
| POST | /api/v1/generate | To generate the .png picture |
body JSON |
Parameters
NB: All parameters value are case sensitive.
| Name | Value | Type | Mandatory |
|---|---|---|---|
| bg | ["BG1","BG2","BG3","BG4","BG5","BG6","BG7"] |
String | NO |
| base | ["B1","B2"] |
String | YES |
| skin | ["S1","S2","S3","S4","S5","S6",] |
String | YES |
| mouth | ["M1","M2","M3","M4","M5","M6","M7","M8","M9","M10","M11","M12","M13",] |
String | YES |
| nose | ["N1","N2","N3","N4","N5","N6","N7","N8","N9","N10","N11","N12",] |
String | YES |
| hair type | ["H1","H2","H3","H4","H5","H6","H7","H8","H9","H10",] |
String | YES |
| hair color | [1,2,3,4] |
Int | YES |
| ears | ["EA1", "EA2"] |
String | YES |
| eyes type | ["E1","E2","E3","E4","E5",] |
String | YES |
| eyes color | [1,2,3,4,5,6] |
Int | YES |
Example request:
{
"bg": "BG2",
"base": "B1",
"skin": "S1",
"mouth": "M4",
"nose": "N12",
"hair": {
"type": "H10",
"color": 1
},
"ears": "EA2",
"eyes": {
"color": 1,
"type": "E1"
}
}- [] Handle of different image's file type
- [] Limit request from the same IP
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt for more information.
Samuele Scatena - @LinkedIn - [email protected]
Project Link: https://github.com/zanzarone/avatr-api