Skip to content

Instantly share code, notes, and snippets.

View fsojitra's full-sized avatar
🌀

Foram Sojitra fsojitra

🌀
View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
setInterval(function(){
var divUtc = $('#divUTC');
var express = require('express');
var fs = require('fs');
var pdf = require('html-pdf');
var app = express();
app.get('/',function(req, res){
var html = fs.readFileSync('./test/test.html', 'utf8');
var options = { format: 'Letter' };
pdf.create(html, options).toFile('./test.pdf', function(err, resp) {
var express = require("express");
var app = express();
var request = require('request');
var options = {
//url:'https://jsonplaceholder.typicode.com/comments',
url:'http://date.jsontest.com/?service='+'ip',
method: 'get',
//path:'/comments',
headers: {
@fsojitra
fsojitra / faker.js
Created November 21, 2017 11:15
Using Faker.js to add or display fake data into your web app or you can use it if you don't have Database but you want data to display in web app.
//you have to install two dependency "npm install express" and "npm install faker"
var express = require('express');
var faker = require('faker');
var app = express();
app.get('/', function(req, res){
//res.render('index.ejs');
res.json({
@fsojitra
fsojitra / index.ejs
Last active November 20, 2017 14:13
code to upload file to the server with extension using express.js and multer
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<form method="post" enctype="multipart/form-data"><input type="text" name="a">
<input id="file" type="file" name="photo" />
<button type="submit">test</button>