Skip to content

Instantly share code, notes, and snippets.

View jsmsalt's full-sized avatar
🎯
Focusing

José Morales jsmsalt

🎯
Focusing
View GitHub Profile
@jsmsalt
jsmsalt / Main.java
Created September 16, 2019 14:46
Spark Java CORS Fix
options("/*", (request, response) -> {
String accessControlRequestHeaders = request.headers("Access-Control-Request-Headers");
if (accessControlRequestHeaders != null) {
response.header("Access-Control-Allow-Headers", accessControlRequestHeaders);
}
String accessControlRequestMethod = request.headers("Access-Control-Request-Method");
if (accessControlRequestMethod != null) {
response.header("Access-Control-Allow-Methods", accessControlRequestMethod);
}
@jsmsalt
jsmsalt / seeding.py
Last active June 18, 2024 07:07
Seeding data to database using SQLAlchemy and FastAPI
# The simplest solution I found is to set up an event for each table that executes a method after the table is created.
# Database initial data
INITIAL_DATA = {
'users': [
{
'username': 'superuser',
'email': '[email protected]',
'hashed_password': hash_password('123')