Github page.
Création d'un déploiement.
Autre idée, cloner tout simplement la branche master dans la branche gh-pages. that's it.
my-json-server
Créez son propre server JSON !
https://jsonplaceholder.typicode.com/
https://my-json-server.typicode.com/dupontdenis/myJsonServer
En action : https://github.com/dupontdenis/myJsonServer.git
Extension Rest Client
Créer un fichier app.js
const express = require('express');
const bodyParser = require('body-parser');
const app = express()
app.use(bodyParser.json());
const port = 3000
sayhello = function(pers){
return `hello ${pers}`
}
app.post('/', (req, res) => {
res.send(sayhello(req.body && req.body.pers || 'hi'))
})
app.listen(port, () => {
console.log(`Example app listening on port ${port}`)})
Mettre en place l'application :
- npm init -y
- npm install express
Dans un terminal lancez l'application :
- node app.js
Ajouter l'extension Rest API.
Créer un fichier api.http
POST http://localhost:3000
Content-Type: application/json
{"pers":"denis"}
Autre exemple avec une authentification
ES6 module in nodejs
https://stackoverflow.com/questions/46745014/alternative-for-dirname-in-node-js-when-using-es6-modules/53826979#53826979
Inscription à :
Articles (Atom)