Commit cbc31d82ebaf4e81f5b1b78b882b74b595374d1e
Starting again my personal website
Rômulo Alves committed on 6/16/2016, 1:22:29 AMFiles changed
.gitignore | added |
index.js | added |
package.json | added |
routes/index.js | added |
views/index.js | added |
.gitignore | ||
---|---|---|
@@ -1,0 +1,1 @@ | ||
1 | +node_modules |
index.js | ||
---|---|---|
@@ -1,0 +1,42 @@ | ||
1 | +const Hapi = require('hapi'); | |
2 | +const Vision = require('vision'); | |
3 | +const HapiReactViews = require('hapi-react-views'); | |
4 | + | |
5 | +const routes = [ | |
6 | + require('./routes/index') | |
7 | +]; | |
8 | + | |
9 | +const port = process.env.PORT || 8000; | |
10 | + | |
11 | +require('babel-core/register')({ | |
12 | + presets: ['react', 'es2015'] | |
13 | +}); | |
14 | + | |
15 | +const server = new Hapi.Server(); | |
16 | + | |
17 | +server.connection({ | |
18 | + host: 'localhost', | |
19 | + port: port | |
20 | +}); | |
21 | + | |
22 | +server.route(routes); | |
23 | + | |
24 | +server.register(Vision, err => { | |
25 | + if (err) console.log('Failed to load vision.'); | |
26 | + | |
27 | + server.views({ | |
28 | + defaultExtension: 'js', | |
29 | + engines: { | |
30 | + jsx: HapiReactViews, | |
31 | + js: HapiReactViews | |
32 | + }, | |
33 | + compileOptions: {}, | |
34 | + relativeTo: __dirname, | |
35 | + path: 'views' | |
36 | + }); | |
37 | +}); | |
38 | + | |
39 | +server.start(err => { | |
40 | + if (err) throw err; | |
41 | + console.log('Server running at:', server.info.uri); | |
42 | +}); |
package.json | ||
---|---|---|
@@ -1,0 +1,33 @@ | ||
1 | +{ | |
2 | + "name": "romuloalves.github.io", | |
3 | + "version": "1.0.0", | |
4 | + "description": "Personal website", | |
5 | + "main": "index.js", | |
6 | + "scripts": { | |
7 | + "test": "echo \"Error: no test specified\" && exit 1", | |
8 | + "start": "node ./node_modules/nodemon/bin/nodemon ./index.js" | |
9 | + }, | |
10 | + "repository": { | |
11 | + "type": "git", | |
12 | + "url": "git+https://github.com/romuloalves/romuloalves.github.io.git" | |
13 | + }, | |
14 | + "author": "Rômulo Alves <romuloaalv@gmail.com>", | |
15 | + "license": "ISC", | |
16 | + "bugs": { | |
17 | + "url": "https://github.com/romuloalves/romuloalves.github.io/issues" | |
18 | + }, | |
19 | + "homepage": "https://github.com/romuloalves/romuloalves.github.io#readme", | |
20 | + "dependencies": { | |
21 | + "babel-core": "^6.9.1", | |
22 | + "hapi": "^13.4.1", | |
23 | + "hapi-react-views": "^9.0.0", | |
24 | + "react": "^15.1.0", | |
25 | + "react-dom": "^15.1.0", | |
26 | + "vision": "^4.1.0" | |
27 | + }, | |
28 | + "devDependencies": { | |
29 | + "babel-preset-es2015": "^6.9.0", | |
30 | + "babel-preset-react": "^6.5.0", | |
31 | + "nodemon": "^1.9.2" | |
32 | + } | |
33 | +} |
Built with git-ssb-web