GithubHelp home page GithubHelp logo

henriquemalvar / template-nodejs-express-mongo-prisma Goto Github PK

View Code? Open in Web Editor NEW

This project forked from chameleon-stack/template-nodejs-express-mongo-prisma

0.0 0.0 0.0 1.29 MB

JavaScript 0.75% TypeScript 99.25%

template-nodejs-express-mongo-prisma's Introduction

CHAMELEON STACK - KANBAN

๐Ÿ“‹ PREREQUISITES

  • Docker
  • NodeJs
  • NPM

๐Ÿ”ง INSTALLATION PREREQUISITES

Installing NodeJS

Access the following link and download the LTS version

    https://nodejs.org/en

After that, just double-click on the file that was downloaded and install Node by clicking next until it is installed. Run the following command in a terminal (cmd, gitbash or others) to check the version:

    node --version

Also, check the installed NPM version:

    npm --version

Installing Docker

The first step is to set up Docker. For each operating system, you need to follow a step-by-step process:

  • Linux
               https://docs.docker.com/desktop/install/linux-install/
  • Windows (WSL installation and configuration are required)
               https://docs.docker.com/desktop/install/windows-install/
  • macOS
               https://docs.docker.com/desktop/install/mac-install/

Installing the Container for the Project

To install the container that will run in the project, you need to enter the following command in the terminal:

docker run --name mongo -e MONGO_PASSWORD=mypassword -p 27017:27017 -d mongo

In this step, install a DBMS and connect with docker credentials

โš™๏ธ CONFIGURING THE PROJECT

Adding Database Connection Values to .env

Connect to the database created with the variables you used to create the Docker image. Create a file called ".env" at the root of the project and add the variables contained in the ".env.example" file with the value of the database connection URL(mongo://username:password@localhost:5432/database_name). The ".env" file, according to the container you created, would look something like this:

MONGODB_URI=mongo://mongo:mypassword@localhost:27017/chameleon
NODE_ENV=dev

Installing Node.js Packages

Run the following command in the project:

npm install

or

yarn

Add tables

To add the project's tables to your database, it is necessary to make a POST request to the required table using one of the routes:

Create User table: POST  https://localhost:3333/user
Create Card table: POST  https://localhost:3333/card/{user_id}
Create Category table: POST  https://localhost:3333/category/{user_id}

Starting the Project

Run the following command in the project:

npm run dev

or

yarn dev

The project will run at the following URL:

    http://localhost:3333

๐Ÿš€ TESTS

Running Tests

To run the project's tests, you need to add a test database to your project with the name "test" and then change the NODE_ENV variable from dev to test. Your .env file should look like this:

MONGODB_URI='mongo://mongo:mypassword@localhost:5432/test'
NODE_ENV=test

Execute the command:

npm run test

or

yarn test

template-nodejs-express-prisma-mongodb

template-nodejs-express-mongo-prisma's People

Contributors

ibsiany 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.