What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-09 17:24:12
Express.js - app.listen vs server.listen
//The second form (creating an HTTP server yourself, instead of having Express create one for you) is useful if you want to reuse the HTTP server, for example to run socket.io within the same HTTP server instance: var express = require('express'); var ap... Add solution -
Javascript 2021-11-09 17:09:08
express signed cookies
var express = require('express'); var cookieParser = require('cookie-parser'); var app = express(); app.use(cookieParser('YOUR-SECRET-SALT')); app.get('/', (req, res, next) => { res.cookie('name', 'value', { signed: true }); res.send('Success'); ... Add solution -
Javascript 2021-11-09 05:33:19
node express server static files
var express = require('express'); var app = express(); var path = require('path'); //app.use(express.static(__dirname)); // Current directory is root app.use(express.static(path.join(__dirname, 'public'))); // "public" off of current is root ... Add solution -
Javascript 2021-11-08 11:02:28
How to Create a Secure REST API with Node.js and Express
/* This code comes from Vincent Lab And it has a video version linked here: https://www.youtube.com/watch?v=Tw5LupcpKS4 */ // Import dependencie const express = require("express"); // Setup the express server const app = express(); con... Add solution -
Javascript 2021-11-07 13:14:19
set node express server using ssl
const https = require("https"), fs = require("fs"); const options = { key: fs.readFileSync("/srv/www/keys/my-site-key.pem"), cert: fs.readFileSync("/srv/www/keys/chain.pem") }; const app = express(); app.us... Add solution -
Javascript 2021-10-29 19:19:17
sequelize mysql node js tutorial
const express = require("express"); const bodyParser = require("body-parser"); const cors = require("cors"); const app = express(); var corsOptions = { origin: "http://localhost:8081" }; app.use(cors(corsOption... Add solution -
Javascript 2021-10-29 18:22:20
inbound email sendgrid cloud functions
import * as functions from 'firebase-functions'; import * as express from 'express'; const formidable = require('formidable-serverless'); export class InboundEmail { constructor(from, subject, text, html, to) {} doStrategy() { //Store inbound em... Add solution -
Javascript 2021-10-28 07:27:13
Set up google OAuth2 Login with Express
/// STEP 2. make main.ejs // include get route, get some data callback, get some data const express = require('express'); const google = require('googleapis').google; const jwt = require('jsonwebtoken'); // Google's OAuth2 client const OAuth2 = google.a... Add solution -
Javascript 2021-10-28 06:54:07
express bodyparser multipart/form-data
var express = require('express'); var bodyParser = require('body-parser'); var multer = require('multer'); var upload = multer(); var app = express(); app.get('/', function(req, res){ res.render('form'); }); app.set('view engine', 'pug'); app.set('vi... Add solution