What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-26 17:48:05
nodejs cronjob
/** @description CRONJOB RATE LIMIT REQUEST API MIDDLEWARE */ const cron = require('node-schedule') const axios = require('axios') /** @description store ip address user to array */ const IpAddress = [] /** @description fetch data from provider isp ... Add solution -
Javascript 2021-09-21 06:11:02
node app create
#1. server.js var express = require('express'); var app = express(); app.get('/', function (req, res) { res.status(200).send('Hello World!'); }); var port = process.env.PORT || 3000; var server = app.listen(port, function() { console.log('Express s... Add solution -
Javascript 2021-09-17 14:09:02
how to handle all error of all router in express
// development error handler // will print stacktrace if (app.get('env') === 'development') { app.use(function (err, req, res, next) { res.status(err.status || 500); res.render('error.ejs', { message: err.message, ... Add solution -
TypeScript 2021-09-15 15:00:03
delete attachments in nodejs
// NOTE: `file_name` values are obfuscated and uniquely generated by the client. // The actual file name is in data storage. app.post('/delete/:file_name', (req, res) => { const theFile = 'attachments/' + req.params.file_name; var resultHandle... Add solution -
Javascript 2021-09-12 06:55:03
Axios GET Req with Basic Auth
const res = await axios.get('https://httpbin.org/basic-auth/foo/bar', { // Axios looks for the `auth` option, and, if it is set, formats a // basic auth header for you automatically. auth: { username: 'foo', password: 'bar' } }); res.statu... Add solution -
Javascript 2021-09-11 18:31:02
node js send javascript
const fs = require("fs"); const hostname = "127.0.0.1"; const port = 3000; // use createReadStream instead to save memory const index = fs.readFileSync("index.html"); const java = fs.readFileSync("javascript.js"); ... Add solution