Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 2250e64

Browse files
Update Babel Presets and Readme
1 parent 6f566ed commit 2250e64

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

‎.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
node_modules/
2+
package-lock.json

‎README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
# GEDCOM-file-to-JSON-using-Node-JS-with-ES6
2+
### In 5 Steps
23

3-
1. npm install
4+
1. `git clone https://github.com/udayakumarvdm/GEDCOM-file-to-JSON-using-Node-JS-with-ES6.git`
45

5-
2. node app.js
6+
2. `cd GEDCOM-file-to-JSON-using-Node-JS-with-ES6`
67

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`
813

914
Description:
1015
This simple code will return the gedcom file to json using ES6.
@@ -16,7 +21,7 @@ app.js
1621
1. Set the Babel Register, To Convert your Ecmascript 6 code to ecmascript 5.
1722
---------------------------------------------------
1823
require('babel-register')({
19-
presets: [ 'es2015' ]
24+
presets: [ 'env' ]
2025
});
2126

2227
2. Define the module(s), Where we use ES6.

‎app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
require('babel-register')({
3-
presets: [ 'es2015' ]
3+
presets: [ 'env' ]
44
});
55

66
require('./index.js');

‎index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,12 @@ import fs from 'fs';
33
import path from 'path';
44
import gedcom from 'parse-gedcom';
55

6+
console.log(`🚀 Launched in localhost:8080`);
67

78
http.createServer((req, res) => {
8-
fs.readFile(path.resolve(__dirname)+'/ged/ft.ged','utf-8',(err, data) => {
9-
var jsonArrayObj = JSON.stringify(gedcom.parse(data), null, 2);
10-
res.write(jsonArrayObj);
11-
});
9+
res.writeHead(200, {"Content-Type": "application/json"});
10+
fs.readFile(path.resolve(__dirname)+'/ged/ft.ged','utf-8',(err, data) => {
11+
var jsonArrayObj = JSON.stringify(gedcom.parse(data), null, 2);
12+
res.end(jsonArrayObj);
13+
});
1214
}).listen(8080);

‎package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
{
22
"name": "npmgedcome",
3-
"version": "1.0.0",
3+
"version": "1.1.0",
44
"description": "gedcome file to json using node js with es6",
55
"main": "index.js",
66
"scripts": {
7+
"start": "node app.js",
78
"test": "echo \"Error: no test specified\" && exit 1"
89
},
910
"author": "udayakumar",
1011
"license": "ISC",
1112
"dependencies": {
12-
"babel-preset-es2015": "^6.24.1",
13+
"babel-preset-env": "^1.7.0",
1314
"babel-register": "^6.26.0",
1415
"parse-gedcom": "^1.0.3"
1516
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /