A progressive Node.js framework for building efficient and scalable server-side applications.
Nest framework TypeScript starter repository.
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please read more here.
--Who are the first 10 authors ordered by date_of_birth?
select * from author order by date_of_birth limit 10;
--What is the sales total for the author named “Lorelai Gilmore”?
select
sum(quantity * item_price) sale
from
sale_item s
inner join book b on b.id = s.book_id
inner join author a on a.id = b.author_id
where
a.name ilike 'Lorelai Gilmore';
--What are the top 10 performing authors, ranked by sales revenue?
select
a.name,
sum(quantity * item_price) sale
from
sale_item s
inner join book b on b.id = s.book_id
inner join author a on a.id = b.author_id
group by
a.name
order by
sale desc
LIMIT
10;
After configurate the .env file, hit the follow endpoint:
/bookstore?name=Maya%20Schamberger
name parameter is optional
A layer was added to improve performances, it acts as a temporary data store providing high performance data access. For this API use built-in one, an in-memory data store.
Creating a Dockerfile:
FROM node:12.19.0-alpine3.9 AS development
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install glob rimraf
RUN npm install --only=development
COPY . .
RUN npm run build
FROM node:12.19.0-alpine3.9 as production
ARG NODE_ENV=production
ENV NODE_ENV=${NODE_ENV}
WORKDIR /usr/src/app
COPY package*.json ./
RUN npm install --only=production
COPY . .
COPY --from=development /usr/src/app/dist ./dist
CMD ["node", "dist/main"]
The first step to deploying the application to Kubernetes is to build a Docker images. Build and tag the Docker image for the app:
docker build -t ravn_challenge .
then upload image to Docker Hub
docker push <username>/ravn-be-challenge:1.0.0
We are ready to to deploy the Docker image you built to your GKE cluster.
kubectl create deployment ravn-be-challenge --image=<username>/ravn-be-challenge:1.0.0
Set the baseline number of Deployment replicas to 3.
kubectl scale deployment ravn-be-challenge --replicas=3
Create a HorizontalPodAutoscaler resource for the api Deployment
kubectl autoscale deployment ravn-be-challenge --cpu-percent=80 --min=1 --max=5
To see the Pods created, run the following command:
kubectl get pods
Use the kubectl expose command to generate a Kubernetes Service for the ravn-be-challenge deployment
kubectl expose deployment ravn-be-challenge --name=ravn-be-challenge-service --type=LoadBalancer --port 80 --target-port 8080
Here, the --port flag specifies the port number configured on the Load Balancer, and the --target-port flag specifies the port number that the ravn-be-challenge container is listening on.
Run the following command to get the Service details for ravn-be-challenge-service:
kubectl get service
You get the external ip, to look up for the service
Nest is MIT licensed.