Code Monkey home page Code Monkey logo

salespal's Introduction

README

A demo MANK stack (MonogoDB, AngularJS, NodeJS, Koa) stock item app that provides CRUD operations to store vehicle information. It makes use of NodeJS, Koa, and MongoDB to serve a RESTful API, and AngularJS to provide the user interface. The frontend and backend have both been written in Typescript.

Demo

You can visit this page for a Live Demo the login credentials can be found here

How do I get set up?

  • Install a text editor, e.g. Visual Studio Code is recommended
  • Install Node, e.g. brew install node
  • Clone the repository
  • Install Docker

Frontend

The frontend was built using AngularJS.

Running the project

  1. Navigate into the frontend folder cd frontend
  2. Run npm install / yarn install
  3. Run npm run build to build the project. The build artifacts will be stored in the dist/ directory. Use the -prod flag for a production build, alternatively use npm run build:prod
  4. Run npm run start for a dev server. Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.
  5. Run npm run test to execute the unit tests via Karma.
  6. Run npm run e2e to execute the end-to-end tests via Protractor.

Generating new Components

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

Frontend technologies used:

For the application

For testing

Backend

The backend is a NodeJS API, built using Koa, Typescript, and MongoDB.

Running the project

  1. Navigate into the backend folder cd backend
  2. Run npm install / yarn install
  3. Run docker-compose up, this will run the container for MongoDB.
  4. Run docker ps to find the name of the docker container.
  5. Run docker exec -i -t <docker-container-name> /bin/bash to open a bash in the container, e.g. docker exec -i -t salespal /bin/bash
  6. Run npm run build to compile the typescript into the dist folder.
  7. Run npm start to run the application.
  8. Run npm run serve:prod to run the server in a production environment.
  9. Run npm run test:unit to execute the unit tests.
  10. To customize, update the configuration parameters in ./config/default.yml / ./config/production.yml and the docker compose .yml files

Auth and Credentials

The server automatically creates the following test credentials if there are no users in the database:

  • Username: Tester
  • Password: hello123

You can use these credentials to execute the ../users/login api call and retrieve a JWT token.

Generating new Controllers, Models, Repositories, and Services

There is local a generate script available via npm run, that will assist in generating new Controllers, Models, Repositories, and Services. For example, if you have a new table called 'Fish' in your database, you can use this command to help generate all of the boilerplate scaffolding required when using the repository pattern:

  • Run npm run generate
  • Select the component that you would like to generate, e.g. All will generate a Controller, Model, Repository, and Service
  • Provide a name for the component, e.g. Fish, if you need to generate a multi-word component please use LetterCasing, e.g. GoldFish.

The templates can customized as required in ./src/templates/

Backend technologies used:

For the application

For testing

salespal's People

Contributors

nicolaspearson avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

dhyanitha

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.