Skip to content

tahagoal/MusalaTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Musala Soft Task

Prerequisites

To build and run this app locally you will need a few things:

Getting started

  • Clone the repository
git clone https://github.com/tahagoal/MustalaTask

Database

  • Create a new DB called Gateways
  • Run Mongo db on mongodb://localhost:27017/Gateways, as provided on Back/config/default.json

Backend

  • Install dependencies
cd <project_name>/Back
npm install
  • Build and run the backend project with auto reload (nodemon)
npm run server
  • Build and run the project
npm run start

Finally, navigate to http://localhost:5050/ and you should see the API running!

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. This is nice because most JavaScript tools have easy to use command line utilities allowing us to not need grunt or gulp to manage our builds. If you open package.json, you will see a scripts section with all the different scripts you can call. To call a script, simply run npm run <script-name> from the command line. You'll notice that npm scripts can call each other which makes it easy to compose complex builds out of simple individual build scripts. Below is a list of all the scripts this template has available:

Npm Script Description
tsc Transpiles TypeScript codes to JavaScript.
watch-tsc Transpiles TypeScript codes to JavaScript, with auto reload.
deploy Runs node on dist/server.js which is the app's entry point.
watch-deploy Runs node on dist/server.js which is the app's entry point, with auto reload.
server Transpiles TypeScript codes to JavaScript then run node on dist/server.js with auto reload.
start Transpiles TypeScript codes to JavaScript then run node on dist/server.js.

Since we're developing with TypeScript, it is important for the codes to be transpiled first to JavaScript before running the node server. It is best to deploy the app using: npm run server or npm run start command.

Postman collection

Attached postman collection to test the APIs without using the UI. Includes 5 APIs

GET: http://localhost:5050/api/gateways
GET: http://localhost:5050/api/gateways/6109473dfd8bfc9fccf4fe73
GET: http://localhost:5050/api/devices/6107154c311d462d1c1d0d2c
POST: http://localhost:5050/api/gateways
POST: http://localhost:5050/api/devices
DELETE: http://localhost:5050/api/devices/61080270311d462d1c1d0de5

Frontend

cd <project_name>/Front
npm install

This project was generated with Angular CLI version 10.1.4.

Development server

Run ng serve for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

Further help

To get more help on the Angular CLI use ng help or go check out the Angular CLI README.

Automated Build

Just run the file automated-build.sh and ti will install all npm packages and make the dist folder for both front and backend.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published