Giter Site home page Giter Site logo

jovemexausto / desafio-entrevista-nodejs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joaomoura/desafio-entrevista-nodejs

0.0 0.0 0.0 247 KB

A simple NestJS API with TypeORM, MySQL, Swagger, Jest & Docker for a very simple parking lot management system.

JavaScript 1.46% TypeScript 98.21% Dockerfile 0.33%

desafio-entrevista-nodejs's Introduction

Nest Logo

Description

A simple NestJS API with TypeORM, MySQL, Swagger, Jest & Docker for a very simple parking lot management system.

Installation

$ yarn install

Running the app

# start docker mysql container (if you don't have mysql server)
$ docker-compose up -d

# migration run
$ yarn typeorm migration:run

# seed the intial data
$ yarn seed

# development mode
$ yarn start:dev

# SQLite mode
$ NODE_ENV=test yarn start:dev

# production mode
$ npm run start:prod

Authentication

After running the migration, you can use the following credentials to login:

username: rootuser
password: rootpassword

Send a POST request to /auth/login with the above credentials to get the JWT token. After that, you can use the token to access the protected routes. The token should be sent in the Authorization header with the Bearer prefix.

Swagger

Head to http://localhost:3000/api to see the Swagger documentation. You can also use docs/api-json.json file to import the API documentation to Postman.

Test

# unit tests
$ yarn test

# e2e tests
$ yarn test:e2e

# test database connection
$ yarn test:db

Upload image to GPC Container Registry

# build image
$ docker build -t parking-lot-api .

# tag image
$ docker tag parking-lot-api gcr.io/parking-lot-292909/parking-lot-api:latest

# login to GCP Container Registry
$ gcloud auth configure-docker

# upload image to GCP Container Registry
$ docker push gcr.io/parking-lot-292909/parking-lot-api:latest

Deploy to GCP Cloud Run

# deploy to GCP Cloud Run
$ gcloud run deploy parking-lot-api --image gcr.io/parking-lot-292909/parking-lot-api:latest --platform managed

desafio-entrevista-nodejs's People

Contributors

jovemexausto avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.