Commit a40eb06e authored by Andre Blanke's avatar Andre Blanke
Browse files

Accept POST requests from the frontend

parent 13e31034
......@@ -61,9 +61,9 @@ Accessing the short URL will then cause a redirect to the associated long URL st
## Deployment
The project is currently deployed using an Apache Web Server instance which serves the web frontend
by itself and redirects requests other than `/index.html` to the Spring backend running on one of the
workers picked by HAProxy which is running on the frontend server.
The project is currently deployed using an embedded Tomcat instance, the default embedded server used
by Spring Boot, which serves both static files and handles API requests.
Requests are handled on one of the workers picked by HAProxy which is running on the frontend server.
## Introducing further workers
......@@ -73,7 +73,8 @@ an Apache HTTP Server instance and a CockroachDB node.
At the present time some configuration files need to be edited in order to introduce further workers.
The workers are automatically assigned an IP address of the form `192.168.10.(10 + N)` where `N` is
the index of the worker starting with 1.
The IP address `` is reserved for the frontend server running the load balancer.
The IP address `` is reserved for the frontend server responsible for running the load
balancer and initializing the CockroachDB database cluster at provision time.
The following files currently need to be changed when one wants to add or remove a worker:
......@@ -44,3 +44,6 @@ testem.log
# System Files
# frontend-maven-plugin
"licenses": {
"spdx": [
"blueOak": "bronze"
"corrections": true,
"packages": {
"config-chain": "1.1.12",
"cyclist": "0.2.2",
"json-schema": "0.2.3",
"qrcode-terminal": "0.12.0"
Alex K. Wolfe <>
Andrew Bradley <>
Andrew Lunny <>
Arlo Breault <>
Ashley Williams <> <>
Ashley Williams <> <>
Benjamin Coe <>
Benjamin Coe <> <>
Brian White <> <>
Cedric Nelson <>
Charlie Robbins <>
Claudia Hernández <>
Dalmais Maxence <root@ip-10-195-202-5.ec2.internal>
Danila Gerasimov <>
Dave Galbraith <>
David Beitey <>
David Rousselie <>
Domenic Denicola <>
Einar Otto Stangvik <>
Emma Ramirez <>
Erik Wienhold <>
Evan Lucas <> <>
Evan Lucas <> <>
Faiq Raza <>
Forbes Lindesay <>
Forrest L Norvell <> <>
Forrest L Norvell <> <>
Gabriel Barros <>
Geoff Flarity <> <gflarity@raptvm-x02.(none)>
Gregers Gram Rygg <>
Ifeanyi Oraelosi <>
isaacs <> <>
isaacs <> <nope@not.real>
isaacs <> <>
Jake Verbaten <>
James Sanders <>
James Treworgy <>
Jason Smith <>
Jed Fox <>
Jonas Weber <>
Joshua Bennett <>
Joshua Bennett <> <>
Julien Meddah <>
Kat Marchán <> <>
Kevin Lorenz <>
Kris Windham <>
Leonardo Rojas <>
Lin Clark <>
Luke Arduini <> <>
Maciej Małecki <> <>
Martin Ek <>
Max Goodman <>
Maxim Bogushevich <>
Maximilian Antoni <> <>
Michael Hayes <> <>
Misha Kaletsky <>
Nicolas Morel <>
Olivier Melcher <>
Ra'Shaun Stovall <>
Rebecca Turner <> <>
Rebecca Turner <> <>
Ryan Emery <>
Sam Mikes <>
Sreenivas Alapati <>
Stephanie Snopek <>
Takaya Kobayashi <>
Ted Yavuzkurt <> <>
Thomas Reggi <>
Timo Weiß <timoweiss@Timo-MBP.local>
Tony <>
Trent Mick <> <>
Visnu Pitiyanuvath <>
Will Elwood <>
Wout Mertens <>
Yeonghoon Park <>
Zeke Sikelianos <>
Zoujie Wzj <>
# don't need these in the npm package.
# don't ignore .npmignore files
# these are used in some tests.
# need to declare the language as well as the matrix below
language: node_js
- windows
- 12
- 10
- 8
- 6
env: "DEPLOY_VERSION=testing"
- "node . install"
- "node . run tap -- \"test/tap/*.js\" -t600 -Rclassic -c"
# npm CLI Contributor Roles and Responsibilities
## Table of Contents
* [Introduction](#introduction)
* [Code Structure](#code-structure)
* [Running Tests](#running-tests)
* [Debugging](#debugging)
* [Coverage](#coverage)
* [Benchmarking](#benchmarking)
* [Types of Contributions](#types-of-contributions)
* [Contributing an Issue?](#contributing-an-issue)
* [Contributing a Question?](#contributing-a-question)
* [Contributing a Bug Fix?](#contributing-a-bug-fix)
* [Contributing a Feature?](#contributing-a-bug-feature)
* [Development Dependencies](#development-dependencies)
* [Dependencies](#dependencies)
## Introduction
Welcome to the npm CLI Contributor Guide! This document outlines the npm CLI repository's process for community interaction and contribution. This includes the issue tracker, pull requests, wiki pages, and, to a certain extent, outside communication in the context of the npm CLI. This is an entry point for anyone wishing to contribute their time and effort to making npm a better tool for the JavaScript community!
All interactions in the npm repository are covered by the [npm Code of Conduct](
## Code Structure
├── bin/
│ │ # Directory for executable files. It's very rare that you
│ │ # will need to update a file in this directory.
│ │
│ ├── npm # npm-cli entrypoint for bourne shell
│ ├── npm-cli.js # npm-cli entrypoint for node
│ ├── npm.cmd # npm-cli entrypoint for windows
│ ├── npx # npx entrypoint for bourne shell
│ ├── npx-cli.js # npx entrypoint for node
│ └── npx.cmd # npx entrypoint for windows
├── docs/ 📖
│ │ # Directory that contains the documentation website for
│ │ # the npm-cli. You can run this website locally, and have
│ │ # offline docs! 🔥📖🤓
│ │
│ ├── content/ # Markdown files for site content
│ ├── src/ # Source files for the website; gatsby related
│ └── package.json # Site manifest; scripts and dependencies
├── lib/ 📦
│ # All the Good Bits(tm) of the CLI project live here
├── node_modules/ 🔋
│ # Vendored dependencies for the CLI project (See the
│ # dependencies section below for more details).
├── scripts/ 📜
│ # We've created some helper scripts for working with the
│ # CLI project, specifically around managing our vendored
│ # dependencies, merging in pull-requests, and publishing
│ # releases.
├── test/ 🧪
│ # All the tests for the CLI live in this folder. We've
│ # got a lot of tests 🤓🧪🩺
├── # This file! 🎉
└── package.json # The projects main manifest file 📃
## Running Tests
# Make sure you install the dependencies first before running tests.
$ npm install
# Run tests for the CLI (it could take a while).
$ npm run test
## Debugging
It can be tricky to track down issues in the CLI. It's a large code base that has been evolving for over a decade. There is a handy `make` command that will connect the **cloned repository** you have on your machine with the global command, so you can add `console.log` statements or debug any other way you feel most comfortable with.
# Clone the repository to start with
$ git clone
# Change working directories into the repository
$ cd cli
# Make sure you have the latest code (if that's what you're trying to debug)
$ git fetch origin latest
# Connect repository to the global namespace
$ make link
# If you're working on a feature or bug, you can run the same command on your
# working branch and link that code.
# Create new branch to work from (there are many ways)
$ git checkout -b feature/awesome-feature
# Connect repository to global namespace
$ make link
## Coverage
We try and make sure that each new feature or bug fix has tests to go along with them in order to keep code coverages consistent and increasing. We are actively striving for 100% code coverage!
# You can run the following command to find out coverage
$ npm run test-coverage
## Benchmarking
We often want to know if the bug we've fixed for the feature we've added has any sort of performance impact. We've created a [benchmark suite]( to run against the CLI project from pull-requests. If you would like to know if there are any performance impacts to the work you're contributing, simply do the following:
1. Make a pull-request against this repository
2. Add the following comment to the pull-request: "`test this please ✅`"
This will trigger the [benchmark suite]( to run against your pull-request, and when it's finished running it will post a comment on your pull-request just like below. You'll be able to see the results from the suite inline in your pull-request.
> You'll notice that the bot-user will also add a 🚀 reaction to your comment to
let you know that it's sent the request to start the benchmark suite.
If you've updated your pull-request and you'd like to run the the benchmark suite again, simple update your original comment, by adding `test this please ✅` again, or simply just adding another emoji to the **end**. _(The trigger is the phrase "test this please ✅" at the beginning of a comment. Updates will trigger as well, so long as the phrase stays at the beginning.)_.
## Types of Contributions
### Contributing an Issue?
Great!! Is your [new issue]( a [bug](, a [feature](, or a [question](
### Contributing a Question?
Huh? 🤔 Got a situation you're not sure about?! Perfect! We've got some resources you can use.
* Our [documentation site](
* The local docs that come with the CLI project
> **Example**: `npm help install --viewer browser`
* The man pages that are built and shipped with the CLI
> **Example**: `man npm-install` (only on linux/macOS)
* Search of the [current issues](
### Contributing a Bug Fix?
We'd be happy to triage and help! Head over to the issues and [create a new one](!
> We'll need a little bit of information about what happened, rather than "it broke". Such as:
* When did/does this bug happen?
* Can you reproduce it? _(Can you make it happen more than once.)_
* What version of `node`/`npm` are you running on your computer?
* What did you expect it to do?
* What did it _actually do?
* etc...
### Contributing a Feature?
Snazzy, we're always up for fancy new things! If the feature is fairly minor, the team can triage it and prioritize it into our backlog. However, if the feature is a little more complex, then it's best to create an [RFC]( in our [RFC repository]( Exactly how to do that is outlined in that repository. If you're not sure _exactly_ how to implement your idea, or don't want to make a document about your idea, then please create an issue on that repository. We consider these RRFC's, or a "Requesting Request For Comment".
## Development Dependencies
You'll need a few things installed in order to update and test the CLI project during development:
* [node]( v8 or greater
> We recommend that you have a [node version manager]( installed if you plan on fixing bugs that might be present in a specific version of node. With a version manager you can easily switch versions of node and test if your changes to the CLI project are working.
* [git]( v2.11+
## Dependencies
> Package vendoring is commonly referred to as the case where dependent packages are stored in the same place as your project. That usually means you dependencies are checked into your source management system, such as Git.
The CLI project vendors its dependencies in the `node_modules/` folder. Meaning all the dependencies that the CLI project uses are contained within the project itself. This is represented by the `bundledDependencies` section in the root level `package.json` file. The main reason for this is because the `npm` CLI project is distributed with the NodeJS runtime and needs to work out of the box, which means all dependencies need to be available after the runtime is installed.
There are a couple scripts created to help manage this process in the `scripts/` folder.
The npm application
Copyright (c) npm, Inc. and Contributors
Licensed on the terms of The Artistic License 2.0
Node package dependencies of the npm application
Copyright (c) their respective copyright owners
Licensed on their respective license terms
The npm public registry at
and the npm website at
Operated by npm, Inc.
Use governed by terms published on
Trademark Joyent, Inc.,
Neither npm nor npm, Inc. are affiliated with Joyent, Inc.
The Node.js application
Project of Node Foundation,
The npm Logo
Copyright (c) Mathias Pettersson and Brian Hammond
"Gubblebum Blocky" typeface
Copyright (c) Tjarda Koster,
Used with permission
The Artistic License 2.0
Copyright (c) 2000-2006, The Perl Foundation.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This license establishes the terms under which a given free software
Package may be copied, modified, distributed, and/or redistributed.
The intent is that the Copyright Holder maintains some artistic
control over the development of that Package while still keeping the
Package available as open source and free software.
You are always permitted to make arrangements wholly outside of this
license directly with the Copyright Holder of a given Package. If the
terms of this license do not permit the full use that you propose to
make of the Package, you should contact the Copyright Holder and seek
a different licensing arrangement.
"Copyright Holder" means the individual(s) or organization(s)
named in the copyright notice for the entire Package.
"Contributor" means any party that has contributed code or other
material to the Package, in accordance with the Copyright Holder's
"You" and "your" means any person who would like to copy,
distribute, or modify the Package.
"Package" means the collection of files distributed by the
Copyright Holder, and derivatives of that collection and/or of
those files. A given Package may consist of either the Standard
Version, or a Modified Version.
"Distribute" means providing a copy of the Package or making it
accessible to anyone else, or in the case of a company or
organization, to others outside of your company or organization.
"Distributor Fee" means any fee that you charge for Distributing
this Package or providing support for this Package to another
party. It does not mean licensing fees.
"Standard Version" refers to the Package if it has not been
modified, or has been modified only in ways explicitly requested
by the Copyright Holder.
"Modified Version" means the Package, if it has been changed, and
such changes were not explicitly requested by the Copyright
"Original License" means this Artistic License as Distributed with
the Standard Version of the Package, in its current version or as
it may be modified by The Perl Foundation in the future.
"Source" form means the source code, documentation source, and
configuration files for the Package.
"Compiled" form means the compiled bytecode, object code, binary,
or any other form resulting from mechanical transformation or
translation of the Source form.
Permission for Use and Modification Without Distribution
(1) You are permitted to use the Standard Version and create and use
Modified Versions for any purpose without restriction, provided that
you do not Distribute the Modified Version.
Permissions for Redistribution of the Standard Version
(2) You may Distribute verbatim copies of the Source form of the
Standard Version of this Package in any medium without restriction,
either gratis or for a Distributor Fee, provided that you duplicate
all of the original copyright notices and associated disclaimers. At
your discretion, such verbatim copies may or may not include a
Compiled form of the Package.
(3) You may apply any bug fixes, portability changes, and other
modifications made available from the Copyright Holder. The resulting
Package will still be considered the Standard Version, and as such
will be subject to the Original License.
Distribution of Modified Versions of the Package as Source
(4) You may Distribute your Modified Version as Source (either gratis
or for a Distributor Fee, and with or without a Compiled form of the
Modified Version) provided that you clearly document how it differs
from the Standard Version, including, but not limited to, documenting
any non-standard features, executables, or modules, and provided that
you do at least ONE of the following:
(a) make the Modified Version available to the Copyright Holder
of the Standard Version, under the Original License, so that the
Copyright Holder may include your modifications in the Standard
(b) ensure that installation of your Modified Version does not
prevent the user installing or running the Standard Version. In
addition, the Modified Version must bear a name that is different
from the name of the Standard Version.
(c) allow anyone who receives a copy of the Modified Version to
make the Source form of the Modified Version available to others
(i) the Original License or
(ii) a license that permits the licensee to freely copy,
modify and redistribute the Modified Version using the same
licensing terms that apply to the copy that the licensee
received, and requires that the Source form of the Modified
Version, and of any works derived from it, be made freely
available in that license fees are prohibited but Distributor
Fees are allowed.
Distribution of Compiled Forms of the Standard Version
or Modified Versions without the Source
(5) You may Distribute Compiled forms of the Standard Version without
the Source, provided that you include complete instructions on how to
get the Source of the Standard Version. Such instructions must be
valid at the time of your distribution. If these instructions, at any
time while you are carrying out such distribution, become invalid, you
must provide new instructions on demand or cease further distribution.
If you provide valid instructions or cease distribution within thirty
days after you become aware that the instructions are invalid, then
you do not forfeit any of your rights under this license.
(6) You may Distribute a Modified Version in Compiled form without
the Source, provided that you comply with Section 4 with respect to
the Source of the Modified Version.
Aggregating or Linking the Package
(7) You may aggregate the Package (either the Standard Version or
Modified Version) with other packages and Distribute the resulting
aggregation provided that you do not charge a licensing fee for the
Package. Distributor Fees are permitted, and licensing fees for other
components in the aggregation are permitted. The terms of this license
apply to the use and Distribution of the Standard or Modified Versions
as included in the aggregation.
(8) You are permitted to link Modified and Standard Versions with
other works, to embed the Package in a larger work of your own, or to
build stand-alone binary or bytecode versions of applications that
include the Package, and Distribute the result without restriction,
provided the result does not expose a direct interface to the Package.
Items That are Not Considered Part of a Modified Version
(9) Works (including, but not limited to, modules and scripts) that
merely extend or make use of the Package, do not, by themselves, cause
the Package to be a Modified Version. In addition, such works are not
considered parts of the Package itself, and are not subject to the
terms of this license.
General Provisions
(10) Any use, modification, and distribution of the Standard or
Modified Versions is governed by this Artistic License. By using,
modifying or distributing the Package, you accept this license. Do not
use, modify, or distribute the Package, if you do not accept this
(11) If your Modified Version has been derived from a Modified
Version made by someone other than you, you are nevertheless required
to ensure that your Modified Version complies with the requirements of
this license.
(12) This license does not grant you the right to use any trademark,
service mark, tradename, or logo of the Copyright Holder.
(13) This license includes the non-exclusive, worldwide,
free-of-charge patent license to make, have made, use, offer to sell,
sell, import and otherwise transfer the Package with respect to any
patent claims licensable by the Copyright Holder that are necessarily
infringed by the Package. If you institute patent litigation
(including a cross-claim or counterclaim) against any party alleging
that the Package constitutes direct or contributory patent
infringement, then this Artistic License to you shall terminate on the
date that such litigation is filed.
(14) Disclaimer of Warranty: