This is a prototype Node API for filmy profiles.
- This project uses the following technologies:
- Docker
- PostgreSQL
- NodeJS
- Express
-
Clone this repo.
-
Install
Visual Studio CodeIDE for development. -
Install
ESlint ^2.1.13visual studio code extension. -
Install
Dockervisual studio extension to work with Dockerfiles -
Install
Remote - Containersvisual studio extension to work with visual studio code for docker containers. -
Install Docker Desktop in your local system. (Then, make sure docker is running and docker cli is working)
-
Install PostgreSQL and pgAdmin
-
Create
fp-devdatabase in postgres -
Run
docker pull sushabhardy/fp-beto pull latest image. -
Run
docker tag sushabhardy/fp-be fp-be_fp-beto clone image. -
Run
docker-compose upto start the server. -
Open
Dockerimage tab in the left status bar. -
You can see the container named
fp-be_fp-berunning. Right click that container and click onAttach Visual Studio Code. -
A new VSCode window will open. This is the VSCode running inside the container.
-
Do
CTRL + SHIFT + Pto open palette. Search and click onDebug: Attach to Node Process. This will attach debugger to your VSCode and the project will be hosted on localhost:3000 -
You can add breakpoints, update code and then restart the debugger to see changes in the server.
-
This project uses
Github's standard CodeStyle.. More info about it here -
Best practices and rules are defined in
.eslintrc.jsonfile.
- Run
npm run lintto see if code style is followed and build passes. - Run
npm testfor to see if all tests pass.
- Connect to RDS instance and create a new DB named
fp. - Checkout
developbranch offp-noderepo and change.envfile endpoints to point to this DB. - Run
node app.json this and this will run all the DDL, DML and MML on the DB. - Checkout
masterbranch and change endpoints in.envfile. - Build a docker image by running
docker-compose up - This will create an image named
fp-be_fp-be. - Run
docker tag fp-be_fp-be sushabhardy/fp-be. - Run
docker push sushabhardy/fp-beto push the image to docker hub. - Login to AWS and connect to the EC2 instance and run the following command to run container from this image.
sudo service docker startsudo docker pull sushabhardy/fp-besudo docker run -d --rm -p 3000:3000 sushabhardy/fp-be - Now the
fp-bewill run on the ec2 instance on port3000.