Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/?q=api&page=177&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=api

Returns an array of strings in format "username" or "username/projectName"

Found 15445 results for "api"(1062ms)

TastkItindex.ts4 matches

@charmaine•Updated 1 week ago
35runMigrations().catch(console.error);
36
37// Montar rotas da API
38app.route("/api/auth", authRoutes);
39app.route("/api/projects", projectRoutes);
40app.route("/api/tasks", taskRoutes);
41
42// Adicionar rotas de autenticação do lastlogin

TastkIttasks.ts27 matches

@charmaine•Updated 1 week ago
10 deleteTask
11} from "../database/queries.ts";
12import { formatApiResponse } from "../../shared/utils.ts";
13import { CreateTaskInput, UpdateTaskInput } from "../../shared/types.ts";
14
28 if (!body.title) {
29 return c.json(
30 formatApiResponse(false, undefined, "Título da tarefa é obrigatório"),
31 400
32 );
35 if (!body.projectId) {
36 return c.json(
37 formatApiResponse(false, undefined, "ID do projeto é obrigatório"),
38 400
39 );
47 });
48
49 return c.json(formatApiResponse(true, task));
50 } catch (error) {
51 console.error("Erro ao criar tarefa:", error);
52 return c.json(
53 formatApiResponse(false, undefined, "Erro ao criar tarefa"),
54 500
55 );
66 const tasks = await getTasksByUserId(1); // Temporary fix
67
68 return c.json(formatApiResponse(true, tasks));
69 } catch (error) {
70 console.error("Erro ao buscar tarefas:", error);
71 return c.json(
72 formatApiResponse(false, undefined, "Erro ao buscar tarefas"),
73 500
74 );
84 if (isNaN(projectId)) {
85 return c.json(
86 formatApiResponse(false, undefined, "ID de projeto inválido"),
87 400
88 );
93 const tasks = await getTasksByProjectId(projectId, 1); // Temporary fix
94
95 return c.json(formatApiResponse(true, tasks));
96 } catch (error) {
97 console.error("Erro ao buscar tarefas do projeto:", error);
98 return c.json(
99 formatApiResponse(false, undefined, "Erro ao buscar tarefas do projeto"),
100 500
101 );
111 if (isNaN(id)) {
112 return c.json(
113 formatApiResponse(false, undefined, "ID de tarefa inválido"),
114 400
115 );
122 if (!task) {
123 return c.json(
124 formatApiResponse(false, undefined, "Tarefa não encontrada"),
125 404
126 );
127 }
128
129 return c.json(formatApiResponse(true, task));
130 } catch (error) {
131 console.error("Erro ao buscar tarefa:", error);
132 return c.json(
133 formatApiResponse(false, undefined, "Erro ao buscar tarefa"),
134 500
135 );
146 if (isNaN(id)) {
147 return c.json(
148 formatApiResponse(false, undefined, "ID de tarefa inválido"),
149 400
150 );
157 if (!existingTask) {
158 return c.json(
159 formatApiResponse(false, undefined, "Tarefa não encontrada"),
160 404
161 );
166 const updatedTask = await updateTask(id, 1, body); // Temporary fix
167
168 return c.json(formatApiResponse(true, updatedTask));
169 } catch (error) {
170 console.error("Erro ao atualizar tarefa:", error);
171 return c.json(
172 formatApiResponse(false, undefined, "Erro ao atualizar tarefa"),
173 500
174 );
184 if (isNaN(id)) {
185 return c.json(
186 formatApiResponse(false, undefined, "ID de tarefa inválido"),
187 400
188 );
195 if (!existingTask) {
196 return c.json(
197 formatApiResponse(false, undefined, "Tarefa não encontrada"),
198 404
199 );
204 const updatedTask = await toggleTaskCompletion(id, 1); // Temporary fix
205
206 return c.json(formatApiResponse(true, updatedTask));
207 } catch (error) {
208 console.error("Erro ao alternar status de tarefa:", error);
209 return c.json(
210 formatApiResponse(false, undefined, "Erro ao alternar status de tarefa"),
211 500
212 );
222 if (isNaN(id)) {
223 return c.json(
224 formatApiResponse(false, undefined, "ID de tarefa inválido"),
225 400
226 );
233 if (!existingTask) {
234 return c.json(
235 formatApiResponse(false, undefined, "Tarefa não encontrada"),
236 404
237 );
244 if (!deleted) {
245 return c.json(
246 formatApiResponse(false, undefined, "Erro ao excluir tarefa"),
247 500
248 );
250
251 return c.json(
252 formatApiResponse(true, { message: "Tarefa excluída com sucesso" })
253 );
254 } catch (error) {
255 console.error("Erro ao excluir tarefa:", error);
256 return c.json(
257 formatApiResponse(false, undefined, "Erro ao excluir tarefa"),
258 500
259 );

TastkItprojects.ts19 matches

@charmaine•Updated 1 week ago
8 deleteProject
9} from "../database/queries.ts";
10import { formatApiResponse } from "../../shared/utils.ts";
11import { CreateProjectInput, UpdateProjectInput } from "../../shared/types.ts";
12
26 if (!body.name) {
27 return c.json(
28 formatApiResponse(false, undefined, "Nome do projeto é obrigatório"),
29 400
30 );
38 });
39
40 return c.json(formatApiResponse(true, project));
41 } catch (error) {
42 console.error("Erro ao criar projeto:", error);
43 return c.json(
44 formatApiResponse(false, undefined, "Erro ao criar projeto"),
45 500
46 );
57 const projects = await getProjectsByUserId(1); // Temporary fix
58
59 return c.json(formatApiResponse(true, projects));
60 } catch (error) {
61 console.error("Erro ao buscar projetos:", error);
62 return c.json(
63 formatApiResponse(false, undefined, "Erro ao buscar projetos"),
64 500
65 );
75 if (isNaN(id)) {
76 return c.json(
77 formatApiResponse(false, undefined, "ID de projeto inválido"),
78 400
79 );
86 if (!project) {
87 return c.json(
88 formatApiResponse(false, undefined, "Projeto não encontrado"),
89 404
90 );
91 }
92
93 return c.json(formatApiResponse(true, project));
94 } catch (error) {
95 console.error("Erro ao buscar projeto:", error);
96 return c.json(
97 formatApiResponse(false, undefined, "Erro ao buscar projeto"),
98 500
99 );
110 if (isNaN(id)) {
111 return c.json(
112 formatApiResponse(false, undefined, "ID de projeto inválido"),
113 400
114 );
121 if (!existingProject) {
122 return c.json(
123 formatApiResponse(false, undefined, "Projeto não encontrado"),
124 404
125 );
135 );
136
137 return c.json(formatApiResponse(true, updatedProject));
138 } catch (error) {
139 console.error("Erro ao atualizar projeto:", error);
140 return c.json(
141 formatApiResponse(false, undefined, "Erro ao atualizar projeto"),
142 500
143 );
153 if (isNaN(id)) {
154 return c.json(
155 formatApiResponse(false, undefined, "ID de projeto inválido"),
156 400
157 );
164 if (!existingProject) {
165 return c.json(
166 formatApiResponse(false, undefined, "Projeto não encontrado"),
167 404
168 );
175 if (!deleted) {
176 return c.json(
177 formatApiResponse(false, undefined, "Erro ao excluir projeto"),
178 500
179 );
181
182 return c.json(
183 formatApiResponse(true, { message: "Projeto excluído com sucesso" })
184 );
185 } catch (error) {
186 console.error("Erro ao excluir projeto:", error);
187 return c.json(
188 formatApiResponse(false, undefined, "Erro ao excluir projeto"),
189 500
190 );

TastkItApp.tsx1 match

@charmaine•Updated 1 week ago
13 const checkAuth = async () => {
14 try {
15 const response = await fetch("/api/auth/me", {
16 method: "GET",
17 credentials: "include",

TastkItauth.ts5 matches

@charmaine•Updated 1 week ago
1import { Hono } from "https://esm.sh/hono@3.11.7";
2import { formatApiResponse } from "../../shared/utils.ts";
3
4// Create auth router
12 if (!email) {
13 return c.json(
14 formatApiResponse(false, undefined, "Não autorizado"),
15 401
16 );
24 console.error("Erro de autenticação:", error);
25 return c.json(
26 formatApiResponse(false, undefined, "Não autorizado"),
27 401
28 );
36
37 return c.json(
38 formatApiResponse(true, {
39 user: {
40 email: email,
45 console.error("Erro ao verificar autenticação:", error);
46 return c.json(
47 formatApiResponse(false, undefined, "Erro ao verificar autenticação"),
48 500
49 );

project1Profile.tsx7 matches

@Beryl5_Oluoch•Updated 1 week ago
35 try {
36 // Fetch user profile
37 const profileResponse = await fetch("/api/users/profile", {
38 headers: {
39 "Authorization": `Bearer ${token}`
51
52 // Fetch user skills
53 const skillsResponse = await fetch("/api/users/skills", {
54 headers: {
55 "Authorization": `Bearer ${token}`
64
65 // Fetch available skills
66 const availableSkillsResponse = await fetch("/api/users/skills/available", {
67 headers: {
68 "Authorization": `Bearer ${token}`
93
94 try {
95 const response = await fetch("/api/users/profile", {
96 method: "PUT",
97 headers: {
145
146 try {
147 const response = await fetch("/api/users/skills", {
148 method: "POST",
149 headers: {
165
166 // Refresh user skills
167 const skillsResponse = await fetch("/api/users/skills", {
168 headers: {
169 "Authorization": `Bearer ${token}`
190 const handleRemoveSkill = async (skillId: number) => {
191 try {
192 const response = await fetch(`/api/users/skills/${skillId}`, {
193 method: "DELETE",
194 headers: {

project1JobDetail.tsx3 matches

@Beryl5_Oluoch•Updated 1 week ago
22 const fetchJobDetails = async () => {
23 try {
24 const response = await fetch(`/api/jobs/${id}`);
25 const data = await response.json();
26
34 // Check if user has already applied
35 if (isAuthenticated && token) {
36 const applicationsResponse = await fetch("/api/applications/my", {
37 headers: {
38 "Authorization": `Bearer ${token}`
73
74 try {
75 const response = await fetch("/api/applications", {
76 method: "POST",
77 headers: {

project1JobList.tsx3 matches

@Beryl5_Oluoch•Updated 1 week ago
21 try {
22 // Fetch all jobs
23 const response = await fetch("/api/jobs");
24 const data = await response.json();
25
34 // Fetch matching jobs if authenticated
35 if (isAuthenticated && token) {
36 const matchingResponse = await fetch("/api/jobs/matching", {
37 headers: {
38 "Authorization": `Bearer ${token}`
48
49 // Fetch available skills
50 const skillsResponse = await fetch("/api/users/skills/available", {
51 headers: isAuthenticated ? {
52 "Authorization": `Bearer ${token}`

project1Register.tsx1 match

@Beryl5_Oluoch•Updated 1 week ago
41
42 try {
43 const response = await fetch("/api/auth/register", {
44 method: "POST",
45 headers: {

project1Login.tsx1 match

@Beryl5_Oluoch•Updated 1 week ago
26
27 try {
28 const response = await fetch("/api/auth/login", {
29 method: "POST",
30 headers: {

HN-fetch-call2 file matches

@ImGqb•Updated 1 day ago
fetch HackerNews by API

token-server1 file match

@kwhinnery_openai•Updated 3 days ago
Mint tokens to use with the OpenAI Realtime API for WebRTC
Kapil01
apiv1