World Texting Foundation messaging acronyms Restful API.
The API requires Node.js 10.0+. Checkout the docs to see 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 theDATABASE_URL
,TEST_DATABASE_URL
andsecretkey
. - 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
- 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
Request headers:
Content-Type: application/json
Authorization: Bearer<space>token
GET /acronym?from=50&limit=10&search=:search
List acronymsPOST /acronym
Create an acronymPUT /acronym/:id
Edit an acronymDELETE /acronym
Delete an acronym