Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


Build Status

This is simple SPA app using the following technologies:



The deploy example is located on Heroku.

Access (email and password)

Login details specified in the fixtures: fixtures/models/users.js. For example: email, pw mike

Quick start

  1. Start mongodb:
mongod --bind_ip "" --dbpath=/home/youruser/mongodb/mongo.db

The server uses mongoose to work with mongodb. The config files is located here:config/.

  1. Install all dependencies using npm:
npm i
  1. Load fixtures (fixtures/models/) into db:
npm run db:fixtures
  1. Start nodejs server:
npm run server:dev
  1. Build project:
npm run build:watch

The built files (js, css, img) are copied to here: server/public/

  1. Open browser: http://localhost:3000/


  • build:clean - clean the built files from server/public/;
  • build:dev - build project for development;
  • build:prod - build project for production;
  • build:watch - build project for development and starts proxy server for watching changes;
  • server:dev - start nodejs server with development config;
  • server:prod - start nodejs server with production config;
  • server:watch - start nodejs server via nodemon, so you need to install this module globally;
  • db:fixtures: load fixtures (fixtures/models/) to db;
  • test:server - run tests for server api
  • test:client - run unit tests


The server has API routes for work with data application (login, logout, getting from db).If you passed to another url (not API), then the server will always return template server/modules/spa/templates/index.jade (because It's SPA).All API routes require authorization.If you are logged in then the server will respond 200, otherwise 401. For authenticate you need enable automatic sending cookies from js. See example below for fetch.

The server has following API routes:

  • POST /api/login - authorizes user.

Login and password for users are located here: fixtures/models/users.js. Note you need passed user's data into body of request using urlencoded. Note you need enable automatic sending cookies from js for authenticate. For example for fetch:

fetch("http://localhost:3000/api/login", {
  method: "POST",  
  headers: {  
    "Content-type": "application/x-www-form-urlencoded; charset=UTF-8"  
  credentials: "same-origin",
  body: ""

For example for $http:

let access = { email: "", password: "mike" };

$"http://localhost:3000/login", $httpParamSerializerJQLike(access), {
  headers: {
    "Content-Type": "application/x-www-form-urlencoded"
}).then(res =>;
  • POST /api/logout - logout for the current session.

For example for fetch:

fetch("http://localhost:3000/api/logout", {
  method: "POST",  
  credentials: "same-origin"
  • GET /api/users?offset=5&limit=10 - get 10 users from 5. Model see here: server/modules/users/models/user.js.

  • GET /api/users/:id - get user by id

  • DELETE /api/users/:id - remove user by id

  • GET /api/count_letters - get json with the number of letters in mailboxes. Example body of response: {"c7422f8013527a1c20d8dd6d":38,"af1cd994dfcb9286c394d142":8,"4a25fb4d024699c2d82bbd0a":4}

  • GET /api/letters/:id - get letter by id

  • POST /api/letters/ - create new letter. Model see here: server/modules/letters/models/letter.js.

  • DELETE /api/letters/:id - remove letter by id

  • DELETE /api/letters - remove more then one letter. Example the body of request: {"deleteId":["4a25fb4d024699c2d82bbd0a","4a25fb4d024699c2d82bbd0b"]}

  • GET /api/mailboxes - get all mailboxes. Model see here: server/modules/mailboxes/models/mailbox.js.

  • GET /api/mailboxes/:id/letters - get letters by mailbox id

  • DELETE /api/mailboxes/:id/letters - remove all letters by mailbox id




The simple angular spa application




No releases published


No packages published
You can’t perform that action at this time.