Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,36 @@ found at [api.laji.fi](https://apitest.laji.fi/explorer/).
This repo contains 3 main branches. Follow guidelines set in [wiki](http://wiki.helsinki.fi/display/luomusict/Laji.fi+front+kehitysohjeet) for developing.

## Development server
```bash

# clone branch
git clone git@github.com:luomus/laji.git
cd laji
### Installation

Make sure to use the correct node version marked in `.nvmrc`. You can use for example volta or nvm.

# Install application dependencies
# Redis and make sure that it's running
# Python and maker sure that the python executable is in the path
Install the dependencies:

# Install js dependencies (node >= v14)
```bash
npm ci
```

### Running

# Run the environment
```bash
npm start
```

Go with your browser to http://localhost:3000/

### API proxy configuration

# Go with your browser to http://localhost:3000/
By default the app proxies api requests through https://dev.laji.fi/api. You can configure the api base and the access token with `.env` file:

```
API_BASE=https://apitest.laji.fi
ACCESS_TOKEN=<Your access token>
```

## Running end-to-end tests
1. Create an empty `.env` file at the root of the repository:
1. Add the following to `.env` file at the root of the repository:
```
E2E_PERSON_TOKEN=
E2E_USER=
Expand Down
4 changes: 0 additions & 4 deletions config.json

This file was deleted.

36 changes: 18 additions & 18 deletions proxy.conf.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const config = require('./config');
require('dotenv').config();

module.exports = {
'/api/**': {
target: config.api_base,
changeOrigin: true,
xfwd: true,
secure: false,
pathRewrite: {
'^/api/': 'v0/'
},
headers: {
Authorization: config.access_token
},
rewrite: function(req) {
req.url = req.url.replace(/^\/api/, 'v0') +
(req.url.indexOf('?') === -1 ? '?' : '&' ) +
'access_token=' + config.access_token;
}
const proxyConfig = {
target: process.env.API_BASE || "https://dev.laji.fi/api",
changeOrigin: true,
xfwd: true,
secure: false,
pathRewrite: {
'^/api/': 'v0/'
}
};

if (process.env.ACCESS_TOKEN) {
proxyConfig.headers = {
Authorization: process.env.ACCESS_TOKEN
}
}

module.exports = {
'/api/**': proxyConfig
};