Wednesday, October 19, 2016

Node render html file and pass json data to html

Create a server.js file with below code
var express = require('express'),
app = express(),
        http = require('http'),
        httpServer = http.createServer(app);

app.use('/',express.static(path.join(__dirname, '/public')));
app.set('view engine', 'ejs'); // send HTML files
app.engine('html', require('ejs').renderFile);

app.get('test',function(req, res){
 res.render('hello.html',{ 'id' : 'w8m4r9vdfm' });
});

httpServer.listen(8000,"0.0.0.0",function(){
    console.log('http on 8000');
});

Folder structure:
app
  server.js
  public/hello.html

CSS tricks

Mixed paint in background: background: linear-gradient(to right, #b6e358, #38b143) Grid view: display: grid; grid-template-columns: a...