Skip to content

Repository files navigation

Hello API

A small Node.js + Python API demonstrating:

  • Node.js Express API
  • Python worker integration
  • CI with GitHub Actions
  • Unit tests for both Node and Python
  • Containerization with Docker

Table of Contents


Project Overview

This project exposes two main endpoints via Node.js:

  1. /health — simple health check
  2. /reverse — reverses a string using a Python worker script

It includes unit tests and CI workflow to automatically verify both Node.js and Python functionality.


Getting Started

Clone the repo

git clone https://github.com/CormacM22/Hello-API
cd Hello_API

Install dependencies

cd api
npm install

Run the API

node index.js

Visit in your browser or via curl:

Example Images:

/ : Step3

/health : Step7

/reverse?text=hello : Step4

Endpoints

Endpoint Method Description Example
/ GET Root route Returns "Hello API running!"
/health GET Health check { "status": "ok" }
/reverse GET Reverses string /reverse?text=hello{ "reversed": "olleh" }

Tests

Node.js Tests

Run tests:

npm test

Example Output:

Tests passing:
Step2

Python Tests

Run tests:

pytest worker

Example Output: Step5

Continuous Integration

This project uses GitHub Actions to run tests on every push and pull request.

  • Node.js tests run in api/
  • Python tests run in worker/

Workflow Example:
step6

Dockerization

This project has been containerized using Docker. You can build and run it locally with:

docker build -t hello-api .
docker run -p 3000:3000 hello-api

Once running, access the API at:

http://localhost:3000/
http://localhost:3000/health
http://localhost:3000/reverse?text=hello

About

A small API built with Node.js and Python featuring string reversal, health checks, automated testing, GitHub Actions CI, and Docker containerization.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages