Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Initial upload of nodejs-api-quickstart runtime with dockerfile and…
… Pod YAML file for Kubernetes - At the moment, it contains a basic route for getting the current date and time using Moment.js
- Loading branch information
John Jardin john.jardin@ukuvuma.co.za
committed
Jan 23, 2018
1 parent
7f52949
commit d8dff66
Showing
9 changed files
with
507 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
nodejs-api-quickstart/node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
DEPLOY_TYPE=production |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM node:8.9.4-alpine | ||
WORKDIR /nodejs-api-quickstart | ||
ADD . /nodejs-api-quickstart | ||
EXPOSE 3000 | ||
CMD npm start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const http = require('http'); | ||
const bodyParser = require('body-parser'); | ||
const cors = require('cors'); | ||
const express = require('express'); | ||
const router = require('./router'); | ||
const app = express(); | ||
const port = process.env.PORT || 3000; | ||
|
||
app.use(cors()); | ||
app.use(bodyParser.json()); | ||
router(app); | ||
|
||
let server = http.createServer(app); | ||
|
||
server.listen(port, function() { | ||
console.log("NodeJS API Quickstart listening on Port: ", port); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const moment = require('moment'); | ||
|
||
const getCurrentDateTime = function(req, res){ | ||
return res.status(200).send(moment()); | ||
}; | ||
|
||
exports.getCurrentDateTime = getCurrentDateTime; |
Oops, something went wrong.