Compare commits
16 Commits
feature/in
...
feature/bu
| Author | SHA1 | Date | |
|---|---|---|---|
| a0c8a5943c | |||
| e7bf5039a5 | |||
| 8a4463cbc5 | |||
| 54495c0689 | |||
| f51079eeb4 | |||
| fae622aafc | |||
| 5e6da61ccb | |||
| 59c4b0de38 | |||
| 29411d3c87 | |||
| dc79b7bc0e | |||
|
|
d4cc887bf5 | ||
|
|
14da8bf0f1 | ||
|
|
c618675a9a | ||
|
|
80253cabf8 | ||
|
|
2c424ac5d6 | ||
|
|
a558f09fb4 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,2 @@
|
|||||||
**/node_modules
|
**/node_modules
|
||||||
docker/mongodb/data
|
docker/mongodb/data
|
||||||
**/public/bundle.js
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Vanilla JS frontend app.</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div id="content"></div>
|
|
||||||
<script type="application/javascript" src="./bundle.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
version: "3.0"
|
version: "3.6"
|
||||||
services:
|
services:
|
||||||
mongo:
|
mongo:
|
||||||
container_name: "mongo"
|
container_name: "mongo"
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
console.log('Hello world! ++++++');
|
|
||||||
|
|
||||||
document.getElementById('content').innerHTML = `
|
|
||||||
<div>
|
|
||||||
<h1>Hello world!</h1>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
const webpack = require("webpack");
|
|
||||||
const path = require("path");
|
|
||||||
const UglifyJSPlugin = require("uglifyjs-webpack-plugin");
|
|
||||||
|
|
||||||
let config = {
|
|
||||||
entry: "./frontend/src/index.js",
|
|
||||||
output: {
|
|
||||||
path: path.resolve(__dirname, "../backend/public"),
|
|
||||||
filename: "bundle.js"
|
|
||||||
},
|
|
||||||
devServer: {
|
|
||||||
contentBase: path.resolve(__dirname, "../backend/public"),
|
|
||||||
historyApiFallback: true,
|
|
||||||
inline: true,
|
|
||||||
open: true,
|
|
||||||
hot: true
|
|
||||||
},
|
|
||||||
plugins: [
|
|
||||||
new UglifyJSPlugin(),
|
|
||||||
new webpack.SourceMapDevToolPlugin({})
|
|
||||||
],
|
|
||||||
devtool: "eval-source-map"
|
|
||||||
}
|
|
||||||
module.exports = config;
|
|
||||||
4849
package-lock.json
generated
4849
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
12
package.json
12
package.json
@@ -4,9 +4,8 @@
|
|||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "npm-run-all --parallel start-frontend start-backend",
|
"start": "nodemon ./src/js/app.js localhost 3000",
|
||||||
"start-backend": "nodemon ./backend/src/js/app.js localhost 3000",
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
"start-frontend": "webpack --watch --config frontend/webpack.config.js"
|
|
||||||
},
|
},
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
"author": "",
|
"author": "",
|
||||||
@@ -21,11 +20,6 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^7.4.0",
|
"eslint": "^7.4.0",
|
||||||
"eslint-plugin-node": "^11.1.0",
|
"eslint-plugin-node": "^11.1.0",
|
||||||
"nodemon": "^2.0.4",
|
"nodemon": "^2.0.4"
|
||||||
"uglifyjs-webpack-plugin": "^2.2.0",
|
|
||||||
"webpack": "^4.41.2",
|
|
||||||
"webpack-cli": "^3.3.10",
|
|
||||||
"webpack-dev-server": "^3.9.0",
|
|
||||||
"npm-run-all": "^4.1.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,14 +3,13 @@ const bodyParser = require('body-parser');
|
|||||||
const applicationController = require('./controller/applicationCtrl');
|
const applicationController = require('./controller/applicationCtrl');
|
||||||
const userController = require('./controller/userCtrl');
|
const userController = require('./controller/userCtrl');
|
||||||
|
|
||||||
const port = 8080;
|
const port = 3000;
|
||||||
|
|
||||||
const app = express();
|
const app = express();
|
||||||
app.use(bodyParser.urlencoded({ extended: true }));
|
app.use(bodyParser.urlencoded({ extended: true }));
|
||||||
app.use(bodyParser.json());
|
app.use(bodyParser.json());
|
||||||
app.use(express.static('backend/public'));
|
|
||||||
|
|
||||||
app.use('/api/apps', applicationController);
|
app.use('/apps', applicationController);
|
||||||
app.use('/api/users', userController);
|
app.use('/users', userController);
|
||||||
|
|
||||||
app.listen(port, () => console.log('Mock is listening at port ', port, '\n'));
|
app.listen(port, () => console.log('Mock is listening at port ', port, '\n'));
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const yaml = require('yaml');
|
const yaml = require('yaml');
|
||||||
|
|
||||||
const configurationFile = fs.readFileSync('backend/src/resources/application.yml', 'utf8');
|
const configurationFile = fs.readFileSync('src/resources/application.yml', 'utf8');
|
||||||
const configuration = yaml.parse(configurationFile);
|
const configuration = yaml.parse(configurationFile);
|
||||||
module.exports = configuration;
|
module.exports = configuration;
|
||||||
@@ -2,11 +2,6 @@ const router = require('express').Router();
|
|||||||
const tokenService = require('../service/tokenService');
|
const tokenService = require('../service/tokenService');
|
||||||
const userService = require('../service/userService');
|
const userService = require('../service/userService');
|
||||||
|
|
||||||
|
|
||||||
const passwordService = require('../service/passwordService');
|
|
||||||
const Repository = require('../repository/repository');
|
|
||||||
const userRepository = new Repository('users');
|
|
||||||
|
|
||||||
router.post('/login', (request, response) => {
|
router.post('/login', (request, response) => {
|
||||||
const loginRequest = request.body;
|
const loginRequest = request.body;
|
||||||
|
|
||||||
@@ -22,20 +17,4 @@ router.post('/login', (request, response) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
router.post('/init', (request, response) => {
|
|
||||||
userRepository.insert({_id: 'takiguchi', login:'takiguchi', password:passwordService.hashPassword('azer')}, () => {
|
|
||||||
console.log('ok');
|
|
||||||
response.status(200).send();
|
|
||||||
}, () => {
|
|
||||||
console.error('KO');
|
|
||||||
response.status(400).send();
|
|
||||||
});
|
|
||||||
})
|
|
||||||
|
|
||||||
router.get('/test', (request, response) => {
|
|
||||||
response.json({
|
|
||||||
content: 'Hello world from users controller!'
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
Reference in New Issue
Block a user