Skip to content

Instantly share code, notes, and snippets.

@SubhashiniSundaresan
Last active April 25, 2019 12:51
Show Gist options
  • Save SubhashiniSundaresan/13d52d6774465c3b7790fe6cd5fb5775 to your computer and use it in GitHub Desktop.
Save SubhashiniSundaresan/13d52d6774465c3b7790fe6cd5fb5775 to your computer and use it in GitHub Desktop.
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}`)));
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