Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format files and update versions #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nodejs-express-sass/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:7.6.0
FROM mhart/alpine-node:9
WORKDIR /src
# Add app source files
ADD app/src /src
Expand Down
27 changes: 11 additions & 16 deletions nodejs-express-sass/app/src/server.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
var express = require('express');
var path = require('path');
var app = express();
const express = require('express')
const path = require('path')

const app = express()

// Redirect all static files to public/
app.use('/static', express.static(path.join(__dirname, 'public')));
app.use('/static', express.static(path.join(__dirname, 'public')))

var homePath = path.join(__dirname, 'public','html','index.html');
app.get('/', function (req, res) {
res.sendFile(homePath);
});
const homePath = path.join(__dirname, 'public', 'html', 'index.html')
const notFoundPath = path.join(__dirname, 'public', 'html', '404.html')
const port = process.env.APP_PORT || '8080'

var notFoundPath = path.join(__dirname, 'public','html','404.html');
app.all('*', function (req, res) {
res.sendFile(notFoundPath);
});
app.get('/', (req, res) => res.sendFile(homePath))
app.all('*', (req, res) => res.sendFile(notFoundPath))

var port = process.env.APP_PORT ? process.env.APP_PORT : '8080';
app.listen(port, function () {
console.log(`Example app listening on port ${port}!`);
});
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
2 changes: 1 addition & 1 deletion nodejs-express/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mhart/alpine-node:7.6.0
FROM mhart/alpine-node:9

WORKDIR /src

Expand Down
9 changes: 9 additions & 0 deletions nodejs-express/app/src/routes/api.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const express = require('express')

const router = express.Router()

router.get('/', (req, res) => res.send({
message: 'Hello world from Hasura'
}))

module.exports = {router};
7 changes: 7 additions & 0 deletions nodejs-express/app/src/routes/web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const express = require('express')

const router = express.Router()

router.get('/', (req, res) => res.send('Hello world from Hasura'))

module.exports = {router}
15 changes: 6 additions & 9 deletions nodejs-express/app/src/server.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
var express = require('express');
var app = express();
const express = require('express')

//your routes here
app.get('/', function (req, res) {
res.send("Hello World!");
});
const app = express()

app.listen(8080, function () {
console.log('Example app listening on port 8080!');
});
app.use(require('./routes/web').router)
app.use('/api', require('./routes/api').router)

app.listen(8080, () => console.log('Example app listening on port 8080!'))
11 changes: 6 additions & 5 deletions php-apache/app/src/index.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
$json = json_encode(array(
'message' => 'Hello World!'
));
echo $json;
?>

$json = json_encode([
'message' => 'Hello World from Hasura'
]);

echo $json;