小编sam*_*123的帖子

在多容器 docker-compose 设置中,我应该添加什么作为 api 地址?

我有一个简单的 2 个容器 docker-compose 设置。一个前端(Angular)和一个后端(nestjs/express)。

这是我的 docker-compose(开发)

version: "3.3"
services:
  db:
    image: 'postgres:10-alpine'
    container_name: 'postgresnew'
    environment:
      - POSTGRES_USER=postgres
      - POSTGRES_PASSWORD=4321
      - POSTGRES_DB=bleh
    volumes:
      - pgdata:/var/lib/postgresql/data
  frontend:
    build: ./frontendapp
    ports:
      - 4001:4200
    volumes: 
      - ./frontendapp:/app
      - /app/node_modules/
  backend: 
    build: ./backendapp
    ports: 
      - 4000:8080
    volumes:
      - ./backendapp:/app
      - /app/node_modules/
    env_file:
      - .env
volumes: 
  pgdata:
Run Code Online (Sandbox Code Playgroud)

现在,暴露了正确的端口后,我的前端可以使用 localhost:4000 地址轻松访问后端,如我的前端环境中所见

const x = 'http://localhost:4000';

export const environment = {
  production: false,
  API_USERSERVICE: x + "/api/user",
  API_PROJECTSERVICE: x + "/api/project",
  API_TASKSERVICE: x + "/api/task",
  API_PGROUPSERVICE: x …
Run Code Online (Sandbox Code Playgroud)

docker docker-compose angular

1
推荐指数
1
解决办法
451
查看次数

使用 sed 搜索降价

问题

我在一个文件夹中放置了多个 Markdown 文件,格式如下...

# Cool Project
* Random Text 
* Other information
TODO: This is a task
TODO: This is another task
Run Code Online (Sandbox Code Playgroud)

我编写了一个脚本,可以从所有文件中提取以 TODO 开头的所有字符串......

# Cool Project
* Random Text 
* Other information
TODO: This is a task
TODO: This is another task
Run Code Online (Sandbox Code Playgroud)

这给了我这样的输出

TODO: This is a task
TODO: This is another task
Run Code Online (Sandbox Code Playgroud)

我想知道是否有可能使用 sed 从模式中向后看来识别和拾取以开头的行/^# /并将其附加到字符串的末尾......像这样

TODO: This is a task # Cool Project
TODO: This is another task # Cool Project
Run Code Online (Sandbox Code Playgroud)

awk sed

0
推荐指数
2
解决办法
76
查看次数

标签 统计

angular ×1

awk ×1

docker ×1

docker-compose ×1

sed ×1