prueba-backend

Environment vars

This project uses the following environment variables:

Name Description
DB_USER DB USER
DB_PWD DB PASSWORD
DB_NAME DB NAME
DB_SERVER DB SERVER

Pre-requisites

Getting started

  • Clone the repository
git clone  https://github.com/let1s3n/prueba-backend.git
  • Install dependencies
cd prueba-backend
npm install
  • Run the project for dev
npm run dev
  • Build the project
npm run build
  • Run the production build of the project
npm start

Navigate to http://localhost:80

Project Structure

The folder structure of this app is explained below:

Name Description
dist Contains the distributable (or output) from your TypeScript build.
node_modules Contains all npm dependencies.
src Contains source code that will be compiled to the dist dir.
src/controllers Controllers define functions to serve various express routes.
src/database Database connection configuration and setup files.
src/routes Contain all express routes, separated by module/area of application.
src/app.ts Main express server configuration and setup.
src/index.ts Entry point to express app.
package.json Contains npm dependencies as well as build scripts.
tsconfig.json Config settings for compiling source code only written in TypeScript.

Building the project

Running the build

All the different build steps are orchestrated via npm scripts. Npm scripts basically allow us to call (and chain) terminal commands via npm.

Npm Script Description
start Runs full build and runs node on dist/index.js. Can be invoked with npm start
dev Runs the project starting all watch tasks. Can be invoked with npm run dev
build Runs full build. Can be invoked with npm run build