Code files

This commit is contained in:
Akhil
2017-07-31 11:33:31 +05:30
parent 073a63ebdd
commit b9ae409ec0
801 changed files with 17535 additions and 0 deletions
@@ -0,0 +1,19 @@
'use strict'
const {join} = require('path')
const express = require('express')
const index = require('./routes/index')
const app = express()
const dev = process.env.NODE_ENV !== 'production'
const port = process.env.PORT || 3000
if (dev) {
app.use(express.static(join(__dirname, 'public')))
}
app.use('/', index)
app.listen(port, () => {
console.log(`Server listening on port ${port}`)
})
@@ -0,0 +1,15 @@
{
"name": "app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"express": "^4.15.2"
}
}
@@ -0,0 +1,4 @@
body {
padding: 50px;
font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
}
@@ -0,0 +1,22 @@
'use strict'
const {Router} = require('express')
const router = Router()
router.get('/', function (req, res) {
const title = 'Express'
res.send(`
<html>
<head>
<title> ${title} </title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<h1> ${title} </h1>
<p> Welcome to ${title} </p>
</body>
</html>
`)
})
module.exports = router