In order to be able to generate a UUID
you have to pay attention on the several configurations below.
- ✅
uuidgen
comes pre-installed on mostUNIX
systems. Please take a look if you have an error while generating theUUID
.
// middleware/auth.js | |
const jwt = require('jsonwebtoken'); | |
// The secret must be stored in the environment variables | |
const JWT_SECRET = process.env.JWT_SECRET; | |
const authenticateToken = (req, res, next) => { | |
// Retrieve the token from the Authorization header | |
const authHeader = req.headers['authorization']; |
package main | |
import ( | |
"fmt" | |
"golang.org/x/crypto/bcrypt" | |
) | |
func main() { | |
password := []byte("mySecurePassword123") |
# 1. Import FastAPI | |
from fastapi import FastAPI | |
# 2. Create the app | |
app = FastAPI() | |
# 3. Main GET route | |
@app.get("/") | |
async def read_root(): | |
return {"message": "Hello World"} |
// Import the Express framework | |
const express = require('express'); | |
// Create the Express application | |
const app = express(); | |
// Default port or the one defined by the environment | |
const PORT = process.env.PORT || 3000; | |
// Define a basic GET route |
// Module import to generate random keys | |
const crypto = require('crypto'); | |
// Generate 64 random octets then convert them in a hexadecimal String | |
const secret = crypto.randomBytes(64).toString('hex'); | |
// Print the JsonWebToken secret in the console | |
console.log(secret); |