Skip to content

avyrie/affirmations-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Positive Affirmations

I created this fetchable api to be used by whoever needs it to provide several positive affirmations in hopes that it may be used to remind others of their inherent worth. We all need more positivity in our lives and I hope this will help provide the mean to remind others of that.

Fetch Random Affirmation

The below code can be used to fetch a random affirmation from this api using JS fetch:

const fetch = require('node-fetch');
const url = 'https://avyrie.github.io/affirmations-api/affirmations.json';
const randomNum = (arrLength) => {
return Math.floor(Math.random() * arrLength)
}
const fetchData = () => {
fetch(url)
.then(response => response.json())
.then(data => console.log(data.affirmations[(randomNum(data.affirmations.length))]))
.catch(err => {
console.log(err)
})
}

Contributing

Additional contributions are welcome. If you know of a positive affirmation that would be useful to add, please contribute to this open-source project.

Thank you to our current contributors:

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published