The repo of the project of 2nd year of Higher Technical Certificate (BTS SN IR )
·
Report Bug
·
Request Feature
High school Paul Cornu | BTS Systèmes Numériques | Session 2020 |
---|---|---|
9 Rue Paul Cornu, 14100 Lisieux | Option A Informatique et Réseaux | Session 2020 |
Professinal Partner | Studens of the project | Teatchers |
---|---|---|
Interfiltre compagnies | -Mathieu Sanchez | Sébastien Dossier |
Rue de Livarot | -Albert Lanne | Laurent Blondel |
14140 Farvaques | -Alexis Dominguez-Condé | |
-Louis Evrard |
- The master branch have a classe "members" with all CUDR methods (GET,PUT,POST,DELETE).
- The SingleFileCUDR branch have a single file for CUDR
- The HTML branch use the classe "members" with front end vanilla JS.
To test the API i preconise to use postman for HTTP request.
# Install dependecies
npm install
# serve with hot reload at localhost:8080
npm run start
Find the api map with Swaggers at localhost:8080/api/v1/api-docs/#/ and even test it from there.
- This exemple show only for the specific ID
let MembersRouter = express.Router()
MembersRouter.route('/:id')
- Get
.get((req,res)=> {
let index = getIndex(req.params.id);
if (typeof(index) == 'string'){
res.json(error(index))
}else{
res.json(success(members[index]))
}
res.json(success(members[(req.params.id)-1].name))
})
- Overwrite
.put((req,res)=> {
let index = getIndex(req.params.id);
if (typeof(index) == 'string'){
res.json(error(index))
}else{
let same = false;
for (let i = 0; i < members.length; i++){
if (req.body.name == members[i].name && req.params.id != members[i].id){
same = true
break
}
}
if (same){
res.json(error('same name'))
}else{
members[index].name = req.body.name
res.json(success(true))
}
}
})
- Delete
.delete((req,res)=> {
let index = getIndex(req.params.id);
if (typeof(index) == 'string'){
res.json(error(index))
} else {
members.splice(index, 1)
res.json(success(members))
}
})
let MembersRouter = express.Router()
let Members = require('./assets/classes/members-class')(db, config)
MembersRouter.route('/:id')
let MembersRouter = express.Router()
let Members = require('./assets/classes/members-class')(db, config)
MembersRouter.route('/:id')
// Récupère un membre avec son ID
.get(async (req, res) => {
let member = await Members.getById(req.params.id)
res.json(checkAndchange(member))
})
// Modifie un membre avec ID
.put(async(req, res) => {
let updateMember = await Members.update(req.params.id, req.body.name)
res.json(checkAndchange(updateMember))
})
// Supprime un membre avec ID
.delete(async (req, res) => {
let deleteMember = await Members.delete(req.params.id)
res.json(checkAndchange(deleteMember))
})
- Understand async data
console.log('Début')
setTimeout(() => {
console.log('Temps d\'attentes')
},1500)
console.log('Fin')
- Callback
- Promise
new Promise((resolve, reject) => {
setTimeout(()=> {
resolve('All good')
}, 1500)
})
.then(message => console.log(message)) // Dans le cas si c'est ok
.catch(err => console.log(err.message)) // Dans le cas d'une erreur
- Async/Await
The project consists of experimenting with the implementation of computer tools, smartphone applications / Android tablets for operators for :
- Helping the operators of the sheet metal part during cutting with the help of a documented and adapted OF.
Here's why:
- Your time should be focused on creating something amazing. A project that solves a problem and helps others
- You shouldn't be doing the same tasks over and over like creating a README from scratch
- You should element DRY principles to the rest of your life 😄
Of course, no one template will serve all projects since your needs may be different. So I'll be adding more in the near future. You may also suggest changes by forking this repo and creating a pull request or opening an issue.
A list of commonly used resources that I find helpful are listed in the acknowledgements.
The project work with a web app made with nodejs/css. And a mobil applications for QR code.
- npm / node.js
- webstorm
- MySql server
npm install npm@latest -g
- Get a free API Key at https://example.com
- Clone the repo
git clone https://github.com/AlbertLanne/ProductionMonitoringMysql.git
- Install NPM packages
cd ProductionMonitoringMysql && npm install
- Copy
example-config.js
intoconfig.js
and add your data login. You can use URI link.
{
"port": 8080,
"URI":"????????????????????????????????????????????????????????????????????????????????????????????????",
}
or
"db": {
"host": "????????????????????????????????????????????????",
"user": "????????????????????????",
"password": "????????????????????????",
"database": "????????????????????????"
}
}
- You can find the databse structure at assets/sql/BBD.sql
Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
For more examples, please refer to the Documentation
See the open issues for a list of proposed features (and known issues).
- Create a fork of this project
- Clone the project:
git clone https://github.com/<YOUR_GITHUB_USERNAME>/InterfiltreProductionMonitoring
- Create your Feature Branch (
git checkout -b AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Student 2: https://github.com/AlbertLanne
Student 3: https://github.com/Aredi
Student 4: https://github.com/Evouiard