-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from bcgov/feat/setup-express
Setup express
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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}`); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |