Skip to content

LuckyFox31/Hello-World-Fastify-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hello World Fastify API

A small Node.js Fastify API.

Setup

  • Create .env file with .env.example structure and set SERVER_PORT env variable.
  • Install dependencies
npm install
  • Run server
npm start

Available routes

Name Route Method Required properties Description
Home / GET none Return 'Hello World from API !' sentence.
Say hello to someone /hello POST name: string Return 'Hello name !'.

Docker

Build image with Dockerfile :

docker build -t hello-world-fastify-api:latest -f Dockerfile .

Run container with image :

docker run -it -p 3000:3000 hello-world-fastify-api:latest

You can update environment variables in Dockerfile:

ENV SERVER_PORT=3000
ENV SERVER_HOST="0.0.0.0"