Commit 3b05eb3f authored by Hadrien Willemot's avatar Hadrien Willemot

router pour matiere

parent d3bc7d98
const router = require('express').Router();
router.post('/temp', function (req, res) {
//requete de ouf qui fait des trucs mais on l'a pas encore
let matiere = 'Informatique';
res.redirect('/selection_annale?matiere='+matiere);
});
module.exports = router;
\ No newline at end of file
{"tables":{"Promo":{"columns":[{"columnid":"promo_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"annee","dbtypeid":"STRING"},{"columnid":"specialite","dbtypeid":"STRING"}]},"Role":{"columns":[{"columnid":"role_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"}],"dirty":true},"Utilisateur":{"columns":[{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"identifiant","dbtypeid":"STRING","notnull":true},{"columnid":"mot_de_passe","dbtypeid":"STRING","notnull":true},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"prenom","dbtypeid":"STRING"},{"columnid":"email","dbtypeid":"STRING"},{"columnid":"role_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}],"dirty":true},"Matiere":{"columns":[{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"promo_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Sujet":{"columns":[{"columnid":"sujet_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"pdf_sujet","dbtypeid":"STRING"},{"columnid":"pdf_correction","dbtypeid":"STRING"},{"columnid":"verif","dbtypeid":"BOOLEAN"},{"columnid":"date_depot","dbtypeid":"DATE"},{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Commentaire":{"columns":[{"columnid":"com_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"position","dbtypeid":"NUMBER UNSIGNED"},{"columnid":"message","dbtypeid":"STRING"},{"columnid":"typesujet","dbtypeid":"STRING"},{"columnid":"sujet_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Notification":{"columns":[{"columnid":"notif_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Suivre":{"columns":[{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]}},"Promo":[],"Role":[{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"}],"Utilisateur":[{"username":"ihu","password":"$2b$10$PNhFNzA3KuuV.2fKY1CcwuU/7iGgjZeuF1LfoFl.Kjfo9emcYY7aq","email":""},{"username":"ihu","password":"$2b$10$ZUUkLlBmX50KXjoAfKxXXOJZsu..rvnab6F187R1LNhLNqrFvwg2S","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$BsEwI.UI0dxqQgaNCTP8/u9IGtpPipW1kTK3j/fVFNkcaqfvU9odm","firstname":"","lastname":"","email":""}],"Matiere":[],"Sujet":[],"Commentaire":[],"Notification":[],"Suivre":[]}
{"tables":{"Promo":{"columns":[{"columnid":"promo_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"annee","dbtypeid":"STRING"},{"columnid":"specialite","dbtypeid":"STRING"}]},"Role":{"columns":[{"columnid":"role_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"}],"dirty":true},"Utilisateur":{"columns":[{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"identifiant","dbtypeid":"STRING","notnull":true},{"columnid":"mot_de_passe","dbtypeid":"STRING","notnull":true},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"prenom","dbtypeid":"STRING"},{"columnid":"email","dbtypeid":"STRING"},{"columnid":"role_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}],"dirty":true},"Matiere":{"columns":[{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"promo_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Sujet":{"columns":[{"columnid":"sujet_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"nom","dbtypeid":"STRING"},{"columnid":"pdf_sujet","dbtypeid":"STRING"},{"columnid":"pdf_correction","dbtypeid":"STRING"},{"columnid":"verif","dbtypeid":"BOOLEAN"},{"columnid":"date_depot","dbtypeid":"DATE"},{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Commentaire":{"columns":[{"columnid":"com_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"position","dbtypeid":"NUMBER UNSIGNED"},{"columnid":"message","dbtypeid":"STRING"},{"columnid":"typesujet","dbtypeid":"STRING"},{"columnid":"sujet_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Notification":{"columns":[{"columnid":"notif_id","dbtypeid":"NUMBER UNSIGNED","notnull":true,"identity":{"value":1,"step":1}},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]},"Suivre":{"columns":[{"columnid":"matiere_id","dbtypeid":"NUMBER UNSIGNED","notnull":true},{"columnid":"user_id","dbtypeid":"NUMBER UNSIGNED","notnull":true}]}},"Promo":[],"Role":[{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"},{"nom":"Etudiant"},{"nom":"Admin"}],"Utilisateur":[{"username":"ihu","password":"$2b$10$PNhFNzA3KuuV.2fKY1CcwuU/7iGgjZeuF1LfoFl.Kjfo9emcYY7aq","email":""},{"username":"ihu","password":"$2b$10$ZUUkLlBmX50KXjoAfKxXXOJZsu..rvnab6F187R1LNhLNqrFvwg2S","firstname":"","lastname":"","email":""},{"username":"romain","password":"$2b$10$BsEwI.UI0dxqQgaNCTP8/u9IGtpPipW1kTK3j/fVFNkcaqfvU9odm","firstname":"","lastname":"","email":""}],"Matiere":[],"Sujet":[],"Commentaire":[],"Notification":[],"Suivre":[]}
\ No newline at end of file
......@@ -2,7 +2,7 @@
/* global Mustache, page */
'use strict';
import { load_table } from "ssf/types";
//import { load_table } from "ssf/types";
// Le script principal de notre application single page
// Celui-ci effectue le routing coté client (et d'autres choses)
......@@ -63,16 +63,20 @@ page('/signup', async function () {
page('/accueil', async function () {
await renderTemplate(templates('public/templates/accueil.mustache'), context);
let valide = document.querySelector('form');
valide.addEventListener('submit', function (evt) {
evt.preventDefault();
let specialite = getElementByName("specialite");
let annee = getElementByName("annee");
/*let valide = document.querySelector('#form');
valide.addEventListener('click', function () {
//evt.preventDefault();
let specialite = getElementByName("#specialite");
let annee = getElementByName("#annee");
//Faire une requête du style SELECT name FROM promo WHERE promo = <specialite> AND year = <annee>
let promo = 'Informatique'; //Ce que doit renvoyer la requête
page.redirect(`http://localhost:8080/selection_annale`);
})
page(`/selection_annale`);
return false;
})*/
});
/*window.onload = function(){
document.getElementById("form").onsubmit = function(){
......
......@@ -5,7 +5,7 @@
<section>
<h3>Vous êtes un étudiant et vous souhaitez accéder à des annales et/ou proposer des corrigés ?</h3>
<form id="form">
<form id="form" action="/api/matiere/temp" method="POST">
<fieldset>
<p>1) Choisis d'abord ton année</p>
......
......@@ -3,6 +3,7 @@ const express = require('express');
const app = express();
const bodyParser = require('body-parser');
const userRouter = require('./api/users/user.router');
const matiereRouter = require('./api/matiere/matiere.router');
// Le contenu statique public sera lu à partir du repertoire 'public'
app.use('/public', express.static('public'));
......@@ -19,8 +20,10 @@ app.use(bodyParser.json());
// on redirige ce qui vient de /api/users vers userRouter
app.use('/api/users', userRouter);
app.use('/api/matiere', matiereRouter);
// Pour toutes les autres url (catch all) on renverra l'index.html
// c'est le routeur coté client qui fera alors le routing
app.use(function (req, res) {
res.sendFile('public/index.html', {'root': __dirname});
});
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment