a. This site is to work as a consolidating aspect for multiply business's as information is acquired through collection. As a tool for forecasting market trends and stability. b. My target audience is the TOP 500 major suppliers for good and services nationally. c. I have uploaded, what I think is the last version of website landing page.... Which includes The banner header on the top of the page, with two boxes for search, (input/response) with Five drop down labels in a black background: BUSINESS, SERVICES, LOCAL, CATEGORIES, CONTACT. d. THE SEARCH FEATURE MUST BE CONFIGURED AND CONNECTED, ALONG WITH THE BACK-END, FOR FEATURED LISTINGS, LOCAL MAP (PLACEHOLDER)
ADDITIONAL FEATURES, and CONNECTED.
e. NEEDED IS LANDING PAGE FOR crm.BSWMMJ....
To connect your API to a SQL Server database hosted on LAPTOP-8HHDQLH2\dbjre, follow these steps based on your back-end stack. I'll outline the process assuming you're using Node.js with Express and Microsoft SQL Server (MSSQL), which is a common setup.
________________________________________
CopyEdit
const sql = require('mssql');
const config = {
user: 'your_sql_username', // Replace with your SQL Server username
password: 'your_sql_password', // Replace with your SQL Server password
server: 'LAPTOP-8HHDQLH2', // Hostname or Step 1: Install Necessary Tools
a. Install SQL Server Management Studio (SSMS)
• Ensure you have SSMS installed to manage your SQL Server database.
• Confirm that the LAPTOP-8HHDQLH2\dbjre instance is running and accessible.
b. Install Node.js
• Download and install Node.js from nodejs.org.
________________________________________
Step 2: Set Up Your Database
a. Create the Database
1. Open SSMS and connect to LAPTOP-8HHDQLH2\dbjre.
2. Create a database for your project:
sql
CopyEdit
CREATE DATABASE bswmmjbbhe;
b. Create Tables
• Define tables for your data, such as listings or categories. Example:
sql
CopyEdit
CREATE TABLE Listings (
ID INT PRIMARY KEY IDENTITY(1,1),
Name NVARCHAR(100),
Rating INT,
Description NVARCHAR(MAX),
Category NVARCHAR(50),
CreatedAt DATETIME DEFAULT GETDATE()
);
c. Add Sample Data
• Insert some initial data for testing:
sql
CopyEdit
INSERT INTO Listings (Name, Rating, Description, Category)
VALUES ('Sample Business', 5, 'A great place for services.', 'Services');
________________________________________
Step 3: Set Up Your Node.js Application
a. Install Required Dependencies
1. Create a new Node.js project:
bash
CopyEdit
mkdir bswmmjbbhe-api
cd bswmmjbbhe-api
npm init -y
2. Install the MSSQL driver and Express.js:
bash
CopyEdit
npm install express mssql body-parser
b. Configure the Database Connection
1. Create a dbconfig.js file for your database configuration:
javascript
IP address of the SQL server
database: 'bswmmjbbhe', // Database name
options: {
encrypt: true, // Use encryption for data
trustServerCertificate: true, // For self-signed certs
},
};
const poolPromise = new sql.ConnectionPool(config)
.connect()
.then(pool => {
console.log('Connected to SQL Server');
return pool;
})
.catch(err => console.error('Database Connection Failed: ', err));
module.exports = { sql, poolPromise };
c. Create the API Server
1. Create an index.js file:
javascript
CopyEdit
const express = require('express');
const bodyParser = require('body-parser');
const { sql, poolPromise } = require('./dbconfig');
const app = express();
app.use(bodyParser.json());
// Endpoint to fetch all listings
app.get('/api/listings', async (req, res) => {
try {
const pool = await poolPromise;
const result = await pool.request().query('SELECT * FROM Listings');
res.json(result.recordset);
} catch (error) {
console.error('Error fetching listings:', error);
res.status(500).send('Server error');
}
});
// Endpoint to add a new listing
app.post('/api/listings', async (req, res) => {
const { name, rating, description, category } = req.body;
try {
const pool = await poolPromise;
const query = `
INSERT INTO Listings (Name, Rating, Description, Category)
VALUES (@name, @rating, @description, @category)
`;
await pool.request()
.input('name', sql.NVarChar, name)
.input('rating', sql.Int, rating)
.input('description', sql.NVarChar, description)
.input('category', sql.NVarChar, category)
.query(query);
res.send('Listing added successfully');
} catch (error) {
console.error('Error adding listing:', error);
res.status(500).send('Server error');
}
});
const PORT = 5000;
app.listen(PORT, () => console.log(`Server running on port ${PORT}`));
________________________________________
Step 4: Test the API
a. Start the Server
• Run your API server:
bash
CopyEdit
node index.js
b. Test Endpoints
1. Use Postman or any API client to test:
o GET /api/listings: Retrieve listings.
o POST /api/listings: Add a new listing (send JSON body).
c. Sample Request
• POST request to /api/listings:
json
CopyEdit
{
"name": "New Business",
"rating": 4,
"description": "Innovative services for the modern age.",
"category": "Innovation"
}
________________________________________
Step 5: Connect the Front-End
1. Replace the API_BASE URL in your front-end script:
javascript
CopyEdit
const API_BASE = 'http://localhost:5000/api';
2. Deploy the API server and update the URL for production (e.g., https://crm.bswmmjbbhe.directory/api).
________________________________________
Next Steps
1. Test the connection and endpoints end-to-end.
2. Deploy the API server to a hosting platform (e.g., AWS, Azure, or a dedicated server).
3. Share any errors or roadblocks you encounter for additional guidance!
import folium
from geopy.geocoders import Nominatim
from geopy.exc import GeocoderTimedOut
import time
# List of names and addresses
people = [
{"name": "Geraldine Allen", "address": "460 W Palm St, Altadena, CA 91001"},
{"name": "Cushon & Adam Bell", "address": "2690 Highview Ave, Altadena, CA 91001"},
{"name": "Christina Camiling", "address": "272 Laurel Drive, Altadena, CA 91001"},
{"name": "Gina Clayton-Johnson", "address": "113 Congressional Ct, McDonough, GA 30253"},
{"name": "Norma Hobdy", "address": "20630 W Hummingbird Court, Porter Ranch, CA 91236"},
{"name": "Kelly Hokyo & Family", "address": "2354 N Altadena Dr, Altadena, CA 91001"},
{"name": "Jacqueline & David Jacobs", "address": "575 E Howard St, Pasadena, CA 91104"},
{"name": "Taia Love-Luke", "address": "600 Lincoln Ave, Pasadena, CA 91109"},
{"name": "Barbara Martin", "address": "830 Alameda St, Altadena, CA 91001"},
{"name": "Naomi Mauvais", "address": "300 W Calaveras St, Altadena, CA 91001"},
{"name": "Zenobia Millet", "address": "2958 Santa Anita Ave, Altadena, CA 91001"},
{"name": "Dawn Moore", "address": "157 E Las Flores Dr, Altadena, CA 91001"},
{"name": "Jacqueline Robinson-Baisley", "address": "580 W Howard St, Pasadena, CA 91103"},
{"name": "Stephan McGrue", "address": "460 W Palm St, Altadena, CA 91001"}, # Same as Geraldine
]
# Setup map center (Altadena/Pasadena area)
map_center = [34.18, -118.13]
m = folium.Map(location=map_center, zoom_start=12)
# Setup geocoder
geolocator = Nominatim(user_agent="fire_victim_mapper")
# Helper: Retry geocoding if timed out
def geocode_address(address):
try:
return geolocator.geocode(address, timeout=10)
except GeocoderTimedOut:
time.sleep(1)
return geocode_address(address)
# Plot each person
for person in people:
location = geocode_address(person["address"])
if location:
folium.Marker(
location=[location.latitude, location.longitude],
popup=f"{person['name']} {person['address']}",
tooltip=person["name"],
icon=folium.Icon(color="red", icon="info-sign")
).add_to(m)
# Save map to file
m.save("fire_victims_map.html")
print("✅ Map saved as fire_victims_map.html. You can open it in your browser.")