Skip to content

Commit

Permalink
Merge pull request #6 from bcgov/feat/setup-express
Browse files Browse the repository at this point in the history
Setup express
  • Loading branch information
tschbc authored Sep 20, 2024
2 parents a8b5ba4 + 58b3dc4 commit 8146fa0
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
11 changes: 11 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -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}`);
});
17 changes: 17 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 8146fa0

Please sign in to comment.