FirstProjectindex.js4 matches
58const fetchJobs = async () => {
59try {
60const response = await fetch('/api/jobs');
61if (!response.ok) throw new Error('Failed to fetch jobs');
62
104};
105
106const response = await fetch('/api/jobs', {
107method: 'POST',
108headers: {
135const fetchChatMessages = async () => {
136try {
137const response = await fetch('/api/chat');
138if (!response.ok) throw new Error('Failed to fetch chat messages');
139
202
203try {
204const response = await fetch('/api/chat', {
205method: 'POST',
206headers: {
FirstProjectREADME.md1 match
37## Technologies Used
3839- Backend: Hono (API framework)
40- Database: SQLite
41- Frontend: HTML, JavaScript, Tailwind CSS
3import type { SearchRes, LyricsRes } from './types.ts'
45// Define the type for our API response
6interface ApiResponse {
7title: string;
8artist: string;
1516// CORS middleware to allow requests from any origin
17app.use('/api/*', cors());
1819// Define the GET route
20app.get('/api/:track_name/:artist_name?', async (c) => {
21const trackName = c.req.param('track_name');
22const artistNameParam = c.req.param('artist_name'); // This will be undefined if not provided
26}
2728// Construct the query for the suggest API
29// If artist_name is provided, include it in the query for better accuracy.
30// The suggest API seems to work well with "track artist" format.
31const query = artistNameParam ? `${trackName} ${artistNameParam}` : trackName;
3233try {
34// 1. Fetch suggestions
35const suggestUrl = `https://api.lyrics.ovh/suggest/${encodeURIComponent(query)}`;
36console.log(`Fetching suggestions from: ${suggestUrl}`);
37const suggestResponse = await fetch(suggestUrl);
5960// 3. Fetch lyrics
61const lyricsUrl = `https://api.lyrics.ovh/v1/${encodeURIComponent(actualArtist)}/${encodeURIComponent(actualTitle)}`;
62console.log(`Fetching lyrics from: ${lyricsUrl}`);
63const lyricsResponse = await fetch(lyricsUrl);
78console.log('Lyrics received (first 50 chars):', lyricsData.lyrics?.substring(0, 50) + "...");
7980if (lyricsData.error) { // Handle cases where API returns 200 but with an error message in JSON
81return c.json({ error: lyricsData.error }, 404);
82}
88lyrics: "(No lyrics available or instrumental)",
89source: "NOT_A_SOURCE",
90} as ApiResponse, 200);
91}
929394// 4. Combine data and form the response
95const responsePayload: ApiResponse = {
96title: actualTitle,
97artist: actualArtist,
111// Basic route for testing if the worker is up
112app.get('/', (c) => {
113return c.text('Hono Lyrics API worker is running!');
114});
115
JobPlatformindex.ts2 matches
3637// Mount routes
38app.route("/api/jobs", jobRoutes);
39app.route("/api/chat", chatRoutes);
40app.route("/", staticRoutes);
41
JobPlatformapp.js5 matches
85async function loadJobs() {
86try {
87const response = await fetch('/api/jobs');
88if (!response.ok) throw new Error('Failed to fetch jobs');
89
120};
121
122const response = await fetch('/api/jobs', {
123method: 'POST',
124headers: {
187async function loadChatMessages() {
188try {
189const response = await fetch('/api/chat');
190if (!response.ok) throw new Error('Failed to fetch chat messages');
191
235if (lastChatTimestamp) {
236try {
237const response = await fetch(`/api/chat/recent?since=${lastChatTimestamp}`);
238if (!response.ok) throw new Error('Failed to fetch recent messages');
239
278
279try {
280const response = await fetch('/api/chat', {
281method: 'POST',
282headers: {
JobPlatformREADME.md1 match
38## Technologies Used
3940- Backend: Hono (API framework)
41- Database: SQLite
42- Frontend: HTML, JavaScript, Tailwind CSS
35}
3637interface GeniusApiResponse {
38response: {
39sections: Array<{
57): Promise<LyricsResponse> => {
58try {
59const target = `https://genius.com/api/search/multi?per_page=1&q=${
60encodeURIComponent(
61searchTerm,
72};
7374// Make the API request
75const response = await proxiedFetch(target, { headers });
76const data = await response.json();
16- `JobRequirement` - Job requirement data structure
17- `ScoringResult` - Result of scoring a resume against a job requirement
18- `ApiResponse` - Standard API response format
5## Files
67- `index.ts` - Main API entry point with Hono framework (HTTP trigger)
8- `database.ts` - SQLite database operations for storing resumes and job requirements
9- `parser.ts` - Resume parsing logic using OpenAI's GPT models
10- `scorer.ts` - Candidate scoring algorithms and feedback generation
1112## API Endpoints
1314### Resumes
1516- `POST /api/resumes` - Upload a new resume
17- `GET /api/resumes` - Get all resumes
18- `GET /api/resumes/:id` - Get a specific resume by ID
1920### Job Requirements
2122- `POST /api/jobs` - Create a new job requirement
23- `GET /api/jobs` - Get all job requirements
24- `GET /api/jobs/:id` - Get a specific job requirement by ID
2526### Scoring
2728- `POST /api/score` - Score a single resume against a job requirement
29- `POST /api/score/batch` - Score multiple resumes against a job requirement
3031## Database Schema
59});
6061// API Routes
6263// Resume endpoints
64app.post("/api/resumes", async c => {
65try {
66const body = await c.req.json();
101});
102103app.get("/api/resumes", async c => {
104try {
105const resumes = await getAllResumes();
111});
112113app.get("/api/resumes/:id", async c => {
114try {
115const id = parseInt(c.req.param("id"));
131132// Job requirement endpoints
133app.post("/api/jobs", async c => {
134try {
135const body = await c.req.json();
164});
165166app.get("/api/jobs", async c => {
167try {
168const jobs = await getAllJobRequirements();
174});
175176app.get("/api/jobs/:id", async c => {
177try {
178const id = parseInt(c.req.param("id"));
194195// Scoring endpoint
196app.post("/api/score", async c => {
197try {
198const body = await c.req.json();
244245// Batch scoring endpoint
246app.post("/api/score/batch", async c => {
247try {
248const body = await c.req.json();