build: refs #6859 #23
32
README.md
32
README.md
|
@ -2,15 +2,29 @@
|
||||||
|
|
||||||
Worker Time Control is a project developed by Verdnatura Levante SL, designed to manage time-related functionalities. This application helps in efficient time tracking and management for workers.
|
Worker Time Control is a project developed by Verdnatura Levante SL, designed to manage time-related functionalities. This application helps in efficient time tracking and management for workers.
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
Required applications.
|
||||||
|
|
||||||
|
* Node.js
|
||||||
|
* Docker
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
1. Clone the repository:
|
1. Clone the repository.
|
||||||
|
```text
|
||||||
|
$ git clone https://gitea.verdnatura.es/verdnatura/worker-time-control
|
||||||
|
```
|
||||||
|
2. Install dependencies using npm.
|
||||||
|
```text
|
||||||
|
$ npm i
|
||||||
|
```
|
||||||
|
3. Duplicate the `.env.example` file and rename it to `.env`. Then, configure it.
|
||||||
|
```
|
||||||
|
$ cp .env.example .env
|
||||||
|
```
|
||||||
|
|
||||||
git clone https://gitea.verdnatura.es/verdnatura/worker-time-control
|
## Launch
|
||||||
3. Install dependencies using npm:
|
```
|
||||||
|
$ npm start
|
||||||
npm install
|
```
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
npm start
|
|
|
@ -70,7 +70,7 @@ $.ajaxPrefilter(function(xhr) {
|
||||||
headers: {
|
headers: {
|
||||||
Authorization : token
|
Authorization : token
|
||||||
},
|
},
|
||||||
timeout: 1000,
|
timeout: 2000,
|
||||||
contentType: 'application/json; charset=utf-8',
|
contentType: 'application/json; charset=utf-8',
|
||||||
dataType: 'json',
|
dataType: 'json',
|
||||||
processData: false,
|
processData: false,
|
||||||
|
|
15
proxy.js
15
proxy.js
|
@ -3,16 +3,23 @@ const dotenv = require('dotenv');
|
||||||
const { createProxyMiddleware } = require('http-proxy-middleware');
|
const { createProxyMiddleware } = require('http-proxy-middleware');
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
|
const env = process.env;
|
||||||
dotenv.config();
|
dotenv.config();
|
||||||
|
|
||||||
|
if (!env.TARGET || !env.PORT) {
|
||||||
|
console.error(`[ERROR] The '.env' file is not configured`);
|
||||||
|
process.exit();
|
||||||
|
}
|
||||||
|
|
||||||
const apiProxy = createProxyMiddleware('/api', {
|
const apiProxy = createProxyMiddleware('/api', {
|
||||||
target: process.env.TARGET,
|
target: env.TARGET,
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
app.use('/api', apiProxy);
|
app.use('/api', apiProxy);
|
||||||
app.use('/', express.static(__dirname));
|
app.use('/', express.static(__dirname));
|
||||||
|
|
||||||
const port = process.env.PORT;
|
const port = env.PORT;
|
||||||
app.listen(port, () => {
|
app.listen(port, () => {
|
||||||
console.log(`Server running on port: ${port}`);
|
console.log(`[SERVER] Running on port: ${port}`);
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue