Skip to content

3kezoh/justifier

Repository files navigation

Justifier

Justifier is a REST API that justifies text. Check out the documentation for more information.

Prerequisites

Installation

  1. Clone the repo.
git clone https://github.com/3kezoh/justifier.git justifier
  1. Change directory.
cd justifier
  1. Install NPM packages.
npm install
  1. Add environment variables in a .env file.
JWT_SECRET=
JWT_EXPIRATION=
MONGODB_URI=
MONGODB_URI_LOCAL=
MONGODB_URI_TEST=
NODE_ENV=
PORT=
  1. Compile Typescript.
npm run build
# or
npm run build:watch
  1. Start the development server.
npm run dev

Usage

You may want to use Postman or the curl CLI to consume the api.

NOTE There is a rate limit of 80.000 words per/day

Example

You can send HTTP request at the live demo deployed on heroku.

https://ekezoh-justifier.herokuapp.com

  1. Get an access token at /auth/token with an email.
curl --request POST https://justifier-3kezoh.herokuapp.com/auth/token \
--header "Content-Type: application/json" \
--data '{ "email": "user@gmail.com" }'
  1. Justify some text at /api/justify
curl --request POST https://justifier-3kezoh.herokuapp.com/api/justify \
--header "Authorization: Bearer <accessToken>" \
--header "Content-Type: text/plain" \
--data "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean in libero sed sem pulvinar aliquam vitae et quam. Sed in lorem sed neque viverra rutrum. Aenean vitae ultrices diam. Nullam suscipit tincidunt urna. Vestibulum eget fermentum mauris. Duis vel velit volutpat, sodales purus tempor, sodales mi."

About

An API to justify text

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published