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
var express = require("express"), | |
bodyParser = require("body-parser"), | |
logger = require('./logger/logger'), | |
app = express(), | |
port = 3070; |
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
# from base image node | |
FROM node:8.11-slim | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# copying all the files from your file system to container file system | |
COPY package.json . | |
# install all dependencies |
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
var express = require("express"), | |
bodyParser = require("body-parser"), | |
logger = require('./logger/logger'), | |
app = express(), | |
port = 3070; | |
app.use(bodyParser.json()); | |
app.get("/", function(req, res) { | |
logger.info("default route"); |
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
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
const path = require('path'); | |
module.exports = { | |
entry: './index.js', | |
output: { | |
path: path.resolve(__dirname, 'dist'), | |
filename: 'api.bundle.js' | |
}, | |
target: 'node' | |
}; |
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
# from base image node | |
FROM node:8.11-slim | |
RUN mkdir -p /usr/src/app | |
WORKDIR /usr/src/app | |
# copy oter files as well | |
COPY dist/api.bundle.js . | |
#expose the 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
{ | |
"name": "user_api", | |
"version": "1.0.0", | |
"description": "sample rest api", | |
"main": "index.ts", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", |
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
{ | |
"name": "user_api", | |
"version": "1.0.0", | |
"description": "sample rest api", | |
"main": "index.ts", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1" | |
}, | |
"repository": { | |
"type": "git", |
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
import * as express from 'express'; | |
import * as bodyParser from 'body-parser'; | |
class App { | |
public express: express.Application; | |
constructor() { | |
this.express = express(); | |
this.middleware(); |
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
import * as express from 'express'; | |
import * as bodyParser from 'body-parser'; | |
class App { | |
public express: express.Application; | |
// array to hold users | |
users: any[]; |