danielschmitz / discussionboard-api

Discussion Board API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Discussion Board API

A minimalistic Discussion Board API with NodeJS, Express, Knex (sqlite), Joi and Swagger.

Database
Swagger

Install

git clone https://github.com/danielschmitz/discussionboard-api.git
cd discussionboard-api
npm install
npm run migrate
npm run dev

Go to localhost:3001/api-docs. (The port number is set in the src/config.js file)

Atfer the installation, you can always run the server using the npm run dev command.

Se você precisar recriar o banco de dados, delete o arquivo dev.sqlite3 e execute novamente o comando npm run migrate.

How get the Authorization Token

To make some calls to the API, you must be logged in. To do this, go to the /auth/login row in swagger and click on the "Try it Out" button:

Image Example

The swagger setup already comes with the email and password information for user 1. Thus, you do not need to provide any information. Just click the "Execute" button

Image Example

After performing this action, you get the authentication token as an answer:

Image Example

Copy the token, go to the top of the page, and click on the "Authorize" button.

Image Example

With this token, you can access other API calls, such as "/get_hello_world_auth" or edit/delete Categories, Suppliers etc...

Database

The database used is sqlite3. You can use SQLite Viewer extension in the VSCode

About

Discussion Board API


Languages

Language:JavaScript 100.0%