API for getting ascii art strings
I will add the updated instructions for building and deploying here
To run the project install all dependencies using npm:
npm i
Then you can run the project via node:
node app.js
Thats it. For development I use Nodemon which I can recommend for projects like this.
The API works very simple. The request url should be build of like this: http://figlefy.herokuapp.com/figlefy/{URI encoded string}/{font}
The {font}
is optional. If you de not specify any font you will get the default font. A small example using fetch
:
const figlefyAPI = 'http://figlefy.herokuapp.com/figlefy/';
let myString = 'Hello figlefy';
fetch(figlefyAPI + encodeURIComponent(myString))
.then( res => res.text())
.then(figlefied => {
console.log(figlefied);
});
This will return a String
which looks like this when presented in a monospace font:
_ _ _ _ __ _ _ __
| | | | ___| | | ___ / _(_) __ _| | ___ / _|_ _
| |_| |/ _ \ | |/ _ \ | |_| |/ _` | |/ _ \ |_| | | |
| _ | __/ | | (_) | | _| | (_| | | __/ _| |_| |
|_| |_|\___|_|_|\___/ |_| |_|\__, |_|\___|_| \__, |
|___/ |___/
If you want to get an overview of all the posible fonts make a request to /fonts
:
const fontListURL = 'http://figlefy.herokuapp.com//fonts/';
fetch(fontListURL)
.then( res => res.json())
.then(fonts => {
console.log(fonts);
});
Which would present you with a list like this:
[
"3-d",
"3x5",
"5lineoblique",
"acrobatic",
// ....
]