Last active
April 25, 2019 12:51
-
-
Save SubhashiniSundaresan/13d52d6774465c3b7790fe6cd5fb5775 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| npm install -s express | |
| npm install -s morgan chalk | |
| npm install nodemon -g | |
| //Requires | |
| const express = require('express'); | |
| const app = express(); | |
| const path = require('path'); | |
| const chalk = require('chalk'); | |
| const morgan = require('morgan'); | |
| //Static Routes | |
| app.use('/dist', express.static(path.join(__dirname, 'dist'))); | |
| app.use(morgan('dev')) // logging | |
| //Main App Route | |
| app.get('/', (req, res, next) => res.sendFile(path.join(__dirname, 'dist/index.html'))); | |
| const port = 1337; | |
| //Run Server | |
| app.listen(process.env.PORT || port, () => console.log(chalk.blue(`Listening intently on port ${port}`))); |
This file contains hidden or 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
| npm install -s express | |
| npm install -s morgan chalk | |
| npm install nodemon -g | |
| const light = require('tp-link-api-cloud'); | |
| //Requires | |
| const express = require('express'); | |
| const app = express(); | |
| const path = require('path'); | |
| const chalk = require('chalk'); | |
| const morgan = require('morgan'); | |
| //Static Routes | |
| app.use('/dist', express.static(path.join(__dirname, 'dist'))); | |
| app.use(morgan('dev')) // logging | |
| //Main App Route | |
| app.get('/', (req, res, next) => res.sendFile(path.join(__dirname, 'dist/index.html'))); | |
| app.get('/start', (req, res, next) => {light.lightbulb(req.params.brightness)} | |
| const port = 1337; | |
| //Run Server | |
| app.listen(process.env.PORT || port, () => console.log(chalk.blue(`Listening intently on port ${port}`))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment