Как запустить json-сервер в AWS? - PullRequest
0 голосов
/ 03 марта 2019

Моя команда развернула приложение Angular в AWS.Мы использовали json-сервер для создания фиктивного сервиса и базы данных для приложения.Но мы не можем найти способ запустить json-server в aws.Может ли кто-нибудь помочь нам в этом отношении?

Это код трубопровода -

version: 0.0
os: linux
version: 0.2

env:
    variables:
        S3_BUCKET: "initial-codedeploy-bucket-us-east-1-jready"
        APP_NAME: "shopping-city"
        BUILD_ENV : "prod"

phases:
    install:
        commands:
        # Download and Install NodeJS 10.0
        - curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
        - sudo apt-get install -y nodejs
        - echo Installing source NPM dependencies...
        # Install http drivers for node
        - sudo apt-get update -y
        - sudo apt-get install -y apt-transport-https
        # Install Yarn Package Manager (Replace the commands below if you using NPM).
        # - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
        # - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
        - sudo apt-get update -y
        - sudo apt-get install -y npm
        # Install Angular CLI, If you are not using Angular 6, install angular/cli@1.7.0 or lower, confirm by running ng -v inside your project folder
        - npm global add @angular/cli@6.0.8
        # Install node dependancies.
        - npm install

build:
        commands:
        # Builds Angular application. You can also build using custom environment here like mock or staging
        - echo Build started on `date`
        - ng build --${BUILD_ENV}

post_build:
        commands:
        # Clear S3 bucket.
        - aws s3 rm s3://${S3_BUCKET} --recursive
        - echo S3 bucket is cleared.
        # Copy dist folder to S3 bucket, As of Angular 6, builds are stored inside an app folder in distribution and not at the root of the dist folder
        - aws s3 cp dist s3://${S3_BUCKET}/${APP_NAME} --recursive
        - echo Build completed on `date`

artifacts:
    files:
        - '/'
    discard-paths: yes
    base-directory: 'dist*'
...