Node JS basic API

Academic purpose

API Rest :: 2023

Academic purpose

Prerequisites

Clone the repo

> git clone REPO_URI

Enter to folder project

> cd backend

Install the app

> npm i

Create database in docker

docker run --name mongodb -p 27017:27017 -v /your_path/db:/data/db -d mongo

Create .env file

  • Configuration Example:
    • HTTP_HOST -> IP of server, default is 127.0.0.1.
    • HTTP_PORT -> Node listening port, default is 3000.
    • DB_CONNECTION_STRING -> Mongo db connection string, default running locally is mongodb://localhost:27017/my-db

Rename .env.example to .env, and set parameters required, please dont include env:.

env:

# This is parameters required.
HTTP_HOST=
HTTP_PORT=
DB_CONNECTION_STRING=
LOG_ACCESS=

Install nodemon as development dependency

> npm i --save-dev nodemon

Run the seeds

If database is running,

npm run seed

Run the app

If database is running,

Without nodemon

Run project without nodemon

> npm start

With nodemon

Run project with nodemon

> npm run dev

Run tests

none

Access points

domain/api/*

Authenticacion

´´´ none ´´´

API

Author

@jestrade