What do you want to save?
Add Code snippet
New code examples
-
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-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 -
Javascript 2021-10-26 14:14:22
express js sample project
//to run : node filename.js const express = require('express') const app = express() const port = 3000 app.get('/', (req, res) => res.send('Hello World!')) app.listen(port, () => console.log(`Example app listening at http://localhost:${port}`)) /... Add solution -
Javascript 2021-10-23 17:18:06
the script has an unsupported mime type (
app.get("/service-worker.js", (req, res) => { res.sendFile(path.resolve(__dirname, "public", "service-worker.js")); }); app.get("*", function response(req, res) { res.sendFile(path.join(__dirname, "publi... Add solution -
Javascript 2021-10-22 23:04:06
https with express
const fs = require('fs'); const https = require('https'); const app = require('express')(); app.get('*', (req, res) => res.send('<h1>Hello, World</h1>')); const server = https.createServer({ key: fs.readFileSync(`${__dirname}/localhost-... Add solution -
Javascript 2021-10-20 09:13:09
Get requests return html code instead of real data
// use this after route not before route if (process.env.NODE_ENV === 'production') { app.use(express.static(resolve(process.cwd(), 'client/build'))) app.get('*', (req, res) => { res.sendFile(resolve(process.cwd(), 'client/build/index.html')) ... Add solution