diff --git a/b3-dev/node/session3/config.json/config.json b/b3-dev/node/session3/config.json/config.json new file mode 100644 index 0000000..368b111 --- /dev/null +++ b/b3-dev/node/session3/config.json/config.json @@ -0,0 +1,24 @@ +{ + "development": { + "config_id": "development", + "app_name": "conf-test", + "app_desc": "An app to test environnement variables", + "node_port": 3000, + "json_indentation": 4, + "database": "nodesandbox_env-dev" + }, + "testing": { + "config_id": "testing", + "database": "nodesandbox_env-tst" + }, + "staging": { + "config_id": "staging", + "node_port": 8080, + "database": "nodesandbox_env-stage" + }, + "production": { + "config_id": "production", + "node_port": 8080, + "database": "nodesandbox_env" + } +} \ No newline at end of file diff --git a/b3-dev/node/session3/config.json/server.js b/b3-dev/node/session3/config.json/server.js new file mode 100644 index 0000000..0bceeae --- /dev/null +++ b/b3-dev/node/session3/config.json/server.js @@ -0,0 +1,40 @@ +const http = require('http'); +const url = require('url'); + +// load config file +const config = require(process.cwd() + '/config.json'); + +function outputHTML5(status, response, content, title) +{ + response.writeHead(status, { 'Content-Type': 'text/html; charset=utf-8' }); + response.write( + ` + + +
+ +