text 挑战表达
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text 挑战表达相关的知识,希望对你有一定的参考价值。
const express = require('express');
const app = express();
const port = 3000;
const movies = [
{ id: 150, name: 'prout 3, le retour', genre: 'documentaire historique' },
{ id: 151, name: '50 nuances de prout', genre: 'guerre' },
{ id: 152, name: 'tous les prouts du monde', genre: 'romance' }
];
app.get('/', (request, response) => {
response.send('Bienvenue sur Express');
});
app.get('/api/movies', (request, response) => {
response.send("Récupération de tous les films");
});
app.get('/api/movies/:id', (request, response) => {
const movie = movies.filter((id) => id.id === parseInt(request.params.id))
response.json(movie);
});
app.get('/api/employee', (request, response) => {
let name = request.query.name
if (name) {
response.status(404).send(`impossible de récupérer l'employé ${name}`);
} else {
console.log('You are redirected')
response.status(304).send('redirected');
}
});
app.listen(port, (err) => {
if (err) {
throw new Error('Something bad happened...');
}
console.log(`Server is listening on ${port}`);
});
以上是关于text 挑战表达的主要内容,如果未能解决你的问题,请参考以下文章
text 三部曲代码挑战试点
text 挑战JS 1
text 挑战JS 1
text Java编码实践和挑战
text 30天挑战Javascript
text mostFrequentWord分析仪挑战