Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .devcontainer/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ services:
image: nginx/unit:1.22.0-minimal
restart: unless-stopped
volumes:
- ../.unit/config.json:/docker-entrypoint.d/config.json:ro
- ../.unit/config-app.json:/docker-entrypoint.d/config.json:ro
- ../public/:/var/www/public/:ro
- ../src/app.js:/var/www/app.js
#command: ["chmod", "+x", "/var/www/app.js"]
ports:
- 80:80
- 443:443
Expand Down
24 changes: 24 additions & 0 deletions .unit/config-app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"listeners": {
"*:80": {
"pass": "routes"
}
},
"routes": [
{
"action": {
"share": "/www/public/",
"fallback": {
"pass": "applications/node"
}
}
}
],
"applications": {
"node": {
"type": "external",
"working_directory": "/www/",
"executable": "app.js"
}
}
}
Binary file added public/images/banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 9 additions & 0 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env node

import http from "unit-http";

http.createServer(async function (request, response) {
response.writeHead(200, { "Content-Type": "text/html" });
const {x} = await import('./modules/dynamic.js');
response.end("Hello, Node.js on Unit!" + x)
}).listen();