docker for koa
Published in -
22-03-20 00:22
目录
koa
├── docker-compose.yml
└── src
└── index.js
src/index.js
const Koa = require('koa');
const app = new Koa();
const logger = require('koa-logger')
const port = 3000
app.use(logger())
// response
app.use(ctx => {
ctx.body = 'Hello Koa';
});
app.listen(port, () => {
console.log('Listening on port: %d', port)
});
docker-compose.yml
version: "3.7"
services:
koa:
image: node:14.19.0-slim
container_name: koa
command: sh -c "cd /src && yarn add koa koa-logger && node ./index.js"
volumes:
- ./src:/src
networks:
- proxy
^_^ Be the first to comment.
Comment
Nickname
Email (Reply notice)
Website
Content (can use Markdown syntax)