Spaces:
Runtime error
Runtime error
Initial Space setup of opex792/hello-express-api via Builder
Browse files- Dockerfile +13 -0
- package.json +12 -0
- src/index.js +12 -0
Dockerfile
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
FROM node:18-slim
|
2 |
+
|
3 |
+
WORKDIR /usr/src/app
|
4 |
+
|
5 |
+
COPY package*.json ./
|
6 |
+
|
7 |
+
RUN npm install
|
8 |
+
|
9 |
+
COPY . .
|
10 |
+
|
11 |
+
EXPOSE 3000
|
12 |
+
|
13 |
+
CMD ["node", "src/index.js"]
|
package.json
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"name": "hello-express-api",
|
3 |
+
"version": "1.0.0",
|
4 |
+
"description": "",
|
5 |
+
"main": "src/index.js",
|
6 |
+
"type": "module",
|
7 |
+
"scripts": {"start": "node src/index.js" },
|
8 |
+
"keywords": [],
|
9 |
+
"author": "",
|
10 |
+
"license": "ISC",
|
11 |
+
"dependencies": {"express": "^4.18.2" }
|
12 |
+
}
|
src/index.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import express from "express";
|
2 |
+
|
3 |
+
const app = express();
|
4 |
+
const port = 3000;
|
5 |
+
|
6 |
+
app.get("/", (req, res) => {
|
7 |
+
res.send("Hello World!");
|
8 |
+
});
|
9 |
+
|
10 |
+
app.listen(port, () => {
|
11 |
+
console.log(`Example app listening on port ${port}`);
|
12 |
+
});
|