env_file:
- ".env"
VOLUME /api/node_modules
VOLUME /client/node_modules
import dotenv from 'dotenv';
import express from 'express';
const app = express();
dotenv.config({ path: `./.env` });
app.get('/', (req, res) => {
res.send('hello world!!!');
});
app.get('/news', (req, res) => {
res.send([
'static news - 1',
'static news - 2',
'static news - 3'
]);
});
app.listen(process.env.API_PORT, () => {
console.log(`Example app listening at http://localhost:${process.env.API_PORT}`);
});
FROM node:alpine
WORKDIR /api
COPY package.json .
RUN npm install
COPY . .