Skip to content
This repository has been archived by the owner on Jun 6, 2022. It is now read-only.
/ ChooseIpsum Public archive

๐Ÿ’‰ A Lorem Ipsum generator inspired by Trainspotting's Choose Life.

License

Notifications You must be signed in to change notification settings

AtilioA/ChooseIpsum

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

88 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

A Lorem Ipsum generator inspired by Trainspotting's Choose Life.

Heroku App Status License: GPL v3 GitHub code size in bytes

About | API | Running locally

โ„น About

This is a Lorem Ipsum generator made with ReactJS. It is inspired by Trainspotting's Choose Life and was a constructive small project to learn React on my own.

The application is composed by a REST API made with Express and a website running React.

โš™ API

All API access is over HTTPS, and accessed from https://chooseipsum.herokuapp.com/api

Typical request:

curl -i https://chooseipsum.herokuapp.com/api?sentences=5
HTTP/1.1 200 OK
X-Powered-By: Express
Content-Type: application/json; charset=utf-8
Content-Length: 349
ETag: W/"16a-FtCDoVVMzRQhj2DUQvzSktJqzY4"
Date: Mon, 15 Jun 2020 21:03:37 GMT
Connection: keep-alive
{
  "startWithChooseLife": true,
  "nSentences": "5",
  "swear": true,
  "political": true,
  "endWithChooseIpsum": true,
  "format": "json",
  "chooseIpsum": "Choose life. Choose being fitter, happier. Choose key performance indicators. Choose mass shootings. Choose entrepreneurship. Choose slave-made clothes. Choose Lorem. Choose Ipsum."
}

Parameters

All parameters are optional and have default values.

  • startWithChooseLife: whether the lorem ipsum text should begin with "Choose life.". Default: true;
  • nSentences: how many sentences to generate. Default: 20.
  • nParagraphs: how many paragraphs to generate. If this value is informed, nSentences value will be ignored. Default: 3;
  • swear: whether to include sentences with swear words. Default: true;
  • political: whether to include sentences with political content. Default: true;
  • endWithChooseIpsum: whether the lorem ipsum text should end with "Choose lorem. Choose ipsum.". Default: true;
  • format: format of the response (txt, HTML or json). Default: json.

Example of return using all parameters:

{
  "startWithChooseLife": false,
  "nParagraphs": "2",
  "swear": false,
  "political": false,
  "endWithChooseIpsum": false,
  "format": "json",
  "chooseIpsum": [
    "Choose essential oils. Choose dictatorship. Choose mindless distractions but also mindfulness at work. Choose Himalayan salt. Choose walking freely during quarantine. Choose overpriced hardware. Choose this lorem ipsum generator. Choose smart devices that spy on you and your body physiology. Choose not being able to retire and old-age homelessness. Choose mainstream. Choose internet challenges. ",
    "Choose YA and chicklit and bland massproduced airport thrillers with sanitized violence. Choose Alexa, Google Home, Siri. Choose fads. Choose videogames with meaningless choices. Choose your feed. Choose this lorem ipsum generator. Choose a messenger owned by Facebook. Choose mainstream. Choose dictatorship. Choose being the victim of the Dunning-Kruger effect. Choose Xanax. Choose burnout syndrome. Choose hydroxychloroquine. Choose creative idleness. "
  ]
}

๐Ÿก Running locally

Back-end

  1. Clone the repository and enter the folder with your terminal. Then, install all back-end dependencies by executing npm install or yarn.

  2. Set the PORT environment variable in the .env.example file to your desired port and rename the file to .env or, alternatively, set PORT as an environment variable of the system hosting the application.

  3. Start the server with yarn dev.

Front-end

Please note that the front-end of this application does not make any requests to the back-end. Texts are generated in the browser.

  1. Access the web/ directory with your terminal. Install all front-end dependencies with npm install or yarn.

  2. Start the front-end application with yarn start.