Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
No results found
Show changes
Commits on Source (9)
docker-compose.yml
Dockerfile
.gitignore
README.md
.drone.yml
\ No newline at end of file
kind: pipeline
type: docker
name: deploy
clone:
disable: true
steps:
- name: notif build start
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: "Drone Princelle (ERP: student)"
avatar_url: https://s3.princelle.org/share/drone-ci.png
message: >
🚀 Starting deployment of **{{ repo.name }}** repo (*ERP*)...
**Commit from {{commit.author}} on {{commit.branch}}:**
{{commit.message}}
{{ build.link }}
- name: pull
image: appleboy/drone-ssh
settings:
host: flash.princelle.org
username: mprincelle
port: 22
key:
from_secret: ci_key
script:
- cd /app/uni/erp/student
- git fetch --all
- git reset --hard origin/main
- git checkout {{commit.branch}}
- git pull
- name: configure
image: appleboy/drone-ssh
settings:
host: flash.princelle.org
username: mprincelle
port: 22
key:
from_secret: ci_key
script:
- cd /app/uni/erp/student
- echo -e "DB_PORT=2005" > .env
- echo -e "SERVER_PORT=2003" >> .env
- name: build
image: appleboy/drone-ssh
settings:
host: flash.princelle.org
username: mprincelle
port: 22
key:
from_secret: ci_key
script:
- cd /app/uni/erp/student
- docker-compose up -d --build
- name: notif deploy done
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: "Drone Princelle (ERP: student)"
avatar_url: https://s3.princelle.org/share/drone-ci.png
message: >
✅ Successfully deployed **{{ repo.name }}** repo (*ERP*) on Princelle Cloud!
**Commit from {{commit.author}} on {{commit.branch}}:**
{{commit.message}}
**APP URL:** https://student.erp.uni.princelle.org/
{{ build.link }}
when:
status:
- success
- name: notif deploy failure
image: appleboy/drone-discord
settings:
webhook_id:
from_secret: discord_webhook_id
webhook_token:
from_secret: discord_webhook_token
username: "Drone Princelle (ERP: student)"
avatar_url: https://s3.princelle.org/share/drone-ci.png
message: >
⚠️ Error on deploying **{{ repo.name }}** repo (*ERP*) on Princelle Cloud...
**Commit from {{commit.author}} on {{commit.branch}}:**
{{commit.message}}
{{ build.link }}
when:
status:
- failure
trigger:
branch:
- main
SERVER_PORT=27017
APP_PORT=8005
\ No newline at end of file
.idea/
.env
\ No newline at end of file
# jwt-express-react-example
# Partie Student - ERP 2021
A two part example application with a frontend and backend.
Try it out at: http://jwt-express-react-example.trina.si/
## Functionality
- Sign up
- Log in
- [Logged in] Log out
- [Logged in] Change password
- List of all users in the application (sorted by most-liked first)
- Show all users that are currently in the system
- Show number of likes
- [logged in] Like/unlike a user
- jwt token authentication with passport
- At least one test for all endpoints
## Tools used
- [Node.js](https://nodejs.org/en/) v8 (async/await functionality)
- [mongodb](https://www.mongodb.com/), [mongoose](https://mongoosejs.com/)
- [Express.js](https://expressjs.com/)
- [Passport.js](http://www.passportjs.org/) for authentication
- [ReactJS](https://reactjs.org/)
- [Redux](https://redux.js.org/) for state management
- [Mocha](https://mochajs.org/) for testing
## REST endpoints
Features the following REST endpoints:
- /signup
Sign up to the system (username, password)
- /login
Logs in an existing user with a password
- **/me**
Get the currently logged in user information
- **/me/update-password**
Update the current user's password
- /user/:username/
List username & number of likes of a user
- **/user/:username/like**
Like a user
- **/user/:username/unlike**
Unlike a user
- /most-liked
List users in a most liked to least liked
Each user can like another only once, and they can unlike each other.
The bolded endpoints are authenticated calls.
## Usage
### Development
- Run `npm start` in `frontend/`, server will run at `http://localhost:3000`
- Run `npm start` in `backend/`, server will run at `http://localhost:8000`
### Baptiste Cerdan, Victor Vogt, Thomas Steinmetz, Janos Falke
......@@ -2,19 +2,26 @@ version: '3'
services:
mongodb:
image: mongo
container_name: "student_db"
volumes:
- student_db_data:/data/db
ports:
- "27017:27017"
- "${DB_PORT:-27017}:27017"
server:
build: .
depends_on:
- "mongodb"
command: "npm run start:prod"
container_name: "student_app"
ports:
- "8005:8005"
- "${SERVER_PORT:-8005}:8005"
environment:
- CHOKIDAR_USEPOLLING=true
- CI=true
- NODE_ENV=production
- PORT=8005
- MONGO_NAME=mongodb
volumes:
student_db_data:
\ No newline at end of file
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule . /index.html [L]
</IfModule>
import React, { Component } from 'react';
import './App.css';
import {connect} from 'react-redux';
import {BrowserRouter as Router, Route, Link, Redirect} from "react-router-dom";
import {BrowserRouter, Route, Switch , Link, Redirect} from "react-router-dom";
import SignUp from './containers/SignUp.container';
import Login from './containers/Login.container';
import Privacy from './containers/Privacy.container'
......@@ -20,6 +20,7 @@ const PrivateRoute = ({ component: Component, ...rest }) => (
)} />
)
class App extends Component {
// constructor(props) {
// super(props);
......@@ -32,7 +33,8 @@ class App extends Component {
render() {
return (
<Router>
<>
<BrowserRouter>
<div>
<Navbar bg="dark" expand="lg" variant="dark">
<Navbar.Brand>STUDENT</Navbar.Brand>
......@@ -96,14 +98,16 @@ class App extends Component {
</Modal.Footer>
</Modal>
}
</div>
<Switch>
<PrivateRoute path="/" exact component={Profile} />
<Route path="/login" exact component={Login} />
<Route path="/signup/" component={SignUp} />
<Route path="/privacy/" component={Privacy} />
<PrivateRoute path="/bank/" component={Bank} />
</div>
</Router>
</Switch>
</BrowserRouter>
</>
);
}
}
......