This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const app = express(); | |
const path = require('path'); | |
app.use(express.static(__dirname + '/dist/<app-name>')); | |
app.get('*', (req, res) => { | |
res.sendFile(path.join(__dirname + '/dist/<app-name>/index.html')); | |
}); | |
app.listen(process.env.PORT || 5000); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const express = require('express'); | |
const bodyParser = require('body-parser'); | |
const app = express() | |
const upload = require('./multer') | |
const cloudinary = require('./cloudinary') | |
const fs = require('fs'); | |
app.use(bodyParser.urlencoded({ | |
extended: false | |
})) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const cloudinary = require('cloudinary'); | |
const dotenv=require('dotenv'); | |
dotenv.config(); | |
cloudinary.config({ | |
cloud_name: process.env.CLOUD_NAME, | |
api_key: process.env.CLOUDINARY_API_KEY, | |
api_secret: process.env.CLOUDINARY_API_SECRET | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const multer = require('multer'); | |
const storage = multer.diskStorage({ | |
destination: function (req, file, cb) { | |
cb(null, './uploads/') | |
}, | |
filename: function (req, file, cb) { | |
cb(null, new Date().toISOString() + '-' + file.originalname) | |
} | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// app.js | |
const express=require('express'); | |
const bodyParser=require('body-parser'); | |
const app=express(); | |
app.use(bodyParser.urlencoded({ | |
extended: false | |
})) | |
app.use(bodyParser.json()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// server.js | |
const http = require('http'); | |
const app = require('./app'); | |
const port = process.env.PORT || 3000; | |
const server = http.createServer(app); | |
server.listen(port); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.test import Client, TestCase | |
class TestLogin(TestCase): | |
def setUp(self): | |
self.client = Client() | |
self.data = { | |
'username' : 'joshua', | |
'email' : '[email protected]', | |
'password' : 'qwerty' |