diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..5001225 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +# Use the official Node.js image from the Docker Hub +FROM node:22-alpine + +# Create and set the working directory inside the container +WORKDIR /app + +# Copy the package.json and package-lock.json files +COPY package*.json ./ + +# Install the dependencies +RUN npm install + +# Copy the rest of the application files +COPY . . + +# Expose the port your app runs on +EXPOSE 3000 + +# Command to run the application +CMD ["node", "app.js"] diff --git a/app.js b/app.js new file mode 100644 index 0000000..15f7ee9 --- /dev/null +++ b/app.js @@ -0,0 +1,11 @@ +const express = require('express'); +const app = express(); +const port = 3000; + +app.get('/', (req, res) => { + res.json({ message: 'Hello world! This is the visitz-api.' }); +}); + +app.listen(port, () => { + console.log(`API is running at http://localhost:${port}`); +}); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..bf90794 --- /dev/null +++ b/package.json @@ -0,0 +1,17 @@ +{ + "name": "visitz-api", + "version": "0.1.0", + "description": "Middleware API for the MCFD Mobility app.", + "main": "app.js", + "directories": { + "doc": "docs" + }, + "scripts": { + "test": "test" + }, + "author": "MCFD Mobility", + "license": "MIT License", + "dependencies": { + "express": "^4.21.0" + } +}