We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 6f566ed + 2250e64 commit 20645ccCopy full SHA for 20645cc
.gitignore
@@ -0,0 +1,2 @@
1
+node_modules/
2
+package-lock.json
README.md
@@ -1,10 +1,15 @@
# GEDCOM-file-to-JSON-using-Node-JS-with-ES6
+### In 5 Steps
3
-1. npm install
4
+1. `git clone https://github.com/udayakumarvdm/GEDCOM-file-to-JSON-using-Node-JS-with-ES6.git`
5
-2. node app.js
6
+2. `cd GEDCOM-file-to-JSON-using-Node-JS-with-ES6`
7
-3. Run your localhost:8080
8
+3. `npm install`
9
+
10
+4. `npm start`
11
12
+5. Open your favorite browser in `localhost:8080`
13
14
Description:
15
This simple code will return the gedcom file to json using ES6.
@@ -16,7 +21,7 @@ app.js
16
21
1. Set the Babel Register, To Convert your Ecmascript 6 code to ecmascript 5.
17
22
---------------------------------------------------
18
23
require('babel-register')({
19
- presets: [ 'es2015' ]
24
+ presets: [ 'env' ]
20
25
});
26
27
2. Define the module(s), Where we use ES6.
app.js
@@ -1,6 +1,6 @@
require('./index.js');
index.js
@@ -3,10 +3,12 @@ import fs from 'fs';
import path from 'path';
import gedcom from 'parse-gedcom';
+console.log(`🚀 Launched in localhost:8080`);
http.createServer((req, res) => {
- fs.readFile(path.resolve(__dirname)+'/ged/ft.ged','utf-8',(err, data) => {
- var jsonArrayObj = JSON.stringify(gedcom.parse(data), null, 2);
- res.write(jsonArrayObj);
- });
+ res.writeHead(200, {"Content-Type": "application/json"});
+ fs.readFile(path.resolve(__dirname)+'/ged/ft.ged','utf-8',(err, data) => {
+ var jsonArrayObj = JSON.stringify(gedcom.parse(data), null, 2);
+ res.end(jsonArrayObj);
+ });
}).listen(8080);
package.json
@@ -1,15 +1,16 @@
{
"name": "npmgedcome",
- "version": "1.0.0",
+ "version": "1.1.0",
"description": "gedcome file to json using node js with es6",
"main": "index.js",
"scripts": {
+ "start": "node app.js",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "udayakumar",
"license": "ISC",
"dependencies": {
- "babel-preset-es2015": "^6.24.1",
+ "babel-preset-env": "^1.7.0",
"babel-register": "^6.26.0",
"parse-gedcom": "^1.0.3"
}
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments