9andresc / world-texting-foundation

A simple Node.js server that provides an API for WTF (World Texting Foundation)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

World Texting Foundation API

A simple Node.js server that provides an API for WTF (World Texting Foundation)

Installation

  1. Install dependencies
$ npm i
  1. Run DB migrations
$ npm run dbm:run
  1. Run DB seeds
$ npm run dbs:run
  1. Create .env file in root with this content
JWT_SECRET=
PORT=3000
  1. Run script to generate JWT secret
$ npm run spt:secret
  1. Fill JWT_SECRET value
JWT_SECRET=<value>
PORT=3000

Usage

  • To start the API server run
$ npm start
  • To run the test suite
$ npm test
  • There's a Postman collection ready to be imported inside /src/docs
  • If you want to use the guarded endpoints PUT and DELETE /acronym/:acronym, generate a token running
$ npm run spt:token

Acknowledgments

  • Document API using Swagger to have a more universal way to test the endpoints
  • Use Docker to containerize API, and maybe even use a more robust database like PostgreSQL in conjunction

About

A simple Node.js server that provides an API for WTF (World Texting Foundation)


Languages

Language:TypeScript 90.8%Language:JavaScript 9.2%