matteo-azzolini / soa-exam-koa

Rest api example with koa js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

soa-exam-koa

Simple Rest API for Service-Oriented Architectures exam

Written with Koa js

Requests example

Examples of http requests can be found in requests.rest file or inside ./test directory

Setup

Setup environement variables inside .env file.

ACCESS_TOKEN_SECRET

Warning It is mandatory to generate a secret to start the server

Set a value to ACCESS_TOKEN_SECRET so that the server can sign jwt token for authentication

# .env
ACCESS_TOKEN_SECRET=$insert-secret

Example of secret generation with nodejs:

node

require('crypto').randomBytes(64).toString('hex')

Run

Install dependencies

npm install

Start http server

npm run start:http

Start https server

Warning: Requires cert

npm run start:https

Run tests

npm run test

About

Rest api example with koa js


Languages

Language:JavaScript 99.8%Language:Shell 0.2%