Skip to content

natelindev/shuttle-backend

Repository files navigation

Shuttle JS

Introduction

Built with Express, Node.JS, using Typescript

Setup

Install latest Node.js from here

Install latest MongoDB from here

Start the MongoDB using command

mongod
macOS

On macOS, you can install a mongdb GUI client using

brew cask install mongodb
Linux

On linux, you should run MongoDB as a service

vi /etc/systemd/system/mongo.service

Then enter the following:

[Unit]
Description=Mongo DB
After=network.target

[Service]
Type=simple
User=your_user_name
ExecStart=/usr/bin/mongod
Restart=on-failure

[Install]
WantedBy=multi-user.target
Windows

On windows

Add dotenv file

create a .env file in project directory, with content like this:

you can change it to whatever port you prefer

PORT = 7777
SECRET = 'SOME_RANDOM_STRING'
JWT_EXPIRATION_MS = 259200000
MONGODB_CONNECT_STRING = 'mongodb://127.0.0.1:27017/shuttle'
Install dependencies

Install the dependencies using:

yarn install

or

npm install

Run

Enter the project directory and

yarn dev

or

npm start

or

npm run dev

Compile Typescrit and run the JS

Enter the project directory and

yarn prod

or

npm run prod

Lint

You need eslint installed globally

yarn lint

or

npm run lint

Debug

if you are using Visual Studio Code

Go to Settings-> Debug: Node: Auto Attach, Set it to be On

And then

yarn debug

or

npm debug

Run tests

You need jest installed globally

yarn test

or

npm test