Skip to content

Latest commit

 

History

History
43 lines (34 loc) · 1.9 KB

File metadata and controls

43 lines (34 loc) · 1.9 KB

World Texting Foundation

World Texting Foundation messaging acronyms Restful API.

Getting started

The API requires Node.js 10.0+. Checkout the docs to see installation guidelines.

Installation guidelines

  • Clone the repository using https://github.com/PaulSebalu/acronym.git
  • On your command line, switch to the app root directory
  • Install dependencies using yarn install
  • create an .env file and specify the DATABASE_URL, TEST_DATABASE_URL and secretkey.
  • DB URL format: postgres://{user}:{password}@{hostname}:{port}/{database-name}.
  • Run migrations using DATABASE_URL=postgres://{user}:{password}@{hostname}:{port}/{database-name} npm run migrate:up
  • (Optional) Load initial test data using npm run load:db
  • Create a token to access the endpoints using npm run token:create
  • (Optional) Run tests using DATABASE_URL=postgres://{user}:{password}@{hostname}:{port}/{database-name} npm run test )( 💣 Make sure to use the URL to the test database)
  • Start the development server using npm run dev
  • Use postman to test the endpoints listed below

Using Docker

  • Make sure to install and configure docker on your development environment
  • Navigate to the app root directory
  • Run docker compose-up and test the endpoints
  • Use the token eyJhbGciOiJIUzI1NiJ9.ZGV2ZWxvcG1lbnQ.PihyA-FiMXlNaI9DLNLqLiS_8-GVdKyjeTFEPmA4rrY to test the endpoints

API Endpoints

Request headers:
Content-Type: application/json
Authorization: Bearer<space>token

  • GET /acronym?from=50&limit=10&search=:search   List acronyms
  • POST /acronym   Create an acronym
  • PUT /acronym/:id   Edit an acronym
  • DELETE /acronym   Delete an acronym