> Portal Navigation: > > - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version. > - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages). > - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`). > - Top-level index of all portals: https://dev.wix.com/docs/llms.txt > - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt # Method name: get(request: WixHttpFunctionRequest) # Method package: wixHttpFunctions # Method menu location: wixHttpFunctions --> get # Method Link: https://dev.wix.com/docs/velo/velo-only-apis/wix-http-functions/get.md # Method Description: A function that responds to requests made with the HTTP GET method. The HTTP GET method is usually called by consumers to retrieve a resource and should have no other effect. If used in this way and the resource is found, the function should respond with a 200 (OK) status code and the requested resource. Respond to the request by returning a [`WixHttpFunctionResponse`](wix-http-functions.WixHttpFunctionResponse.html) object you create using one of the [`response()`](wix-http-functions.html#response), [`ok()`](wix-http-functions.html#ok), [`created()`](wix-http-functions.html#created), [`notFound()`](wix-http-functions.html#notFound), [`serverError()`](wix-http-functions.html#serverError), [`badRequest()`](wix-http-functions.html#badRequest), or [`forbidden()`](wix-http-functions.html#forbidden) functions. The `get()` function is not a function that you call from your code. You define the function in a file named **http-functions.js** in your site's Backend section. The function is called when your users make HTTP requests using the associated URLs as described below. All GET requests with the following URL will be routed to this function: Premium sites: ``` https://www.{user_domain}/_functions/ ``` Free sites: ``` https://{user_name}.wixsite.com/{site_name}/_functions/ ``` > **Note:** You must publish your site at least once before using both the testing and production endpoints. When you make changes to production endpoints you must publish your site for them to take effect. Testing endpoints will use the latest code in the editor. # Method Code Examples: *** Note: do not assume any prop names or enum values other than the ones in the example. ## Create a GET HTTP function ```javascript // In http-functions.js import {ok, notFound} from 'wix-http-functions'; // URL looks like: // https://www.mysite.com/_functions/myFunction/findMe // or: // https://user.wixsite.com/mysite/_functions/myFunction/findMe export function get_myFunction(request) { if(request.path[0] === "findMe") { const body = "Found it!"; return ok({body: body}); } const body = "Can't find it!"; return notFound({body: body}); } ``` ## Create a GET HTTP function ```javascript // In http-functions.js import {ok, notFound, serverError} from 'wix-http-functions'; import wixData from 'wix-data'; // URL looks like: // https://www.mysite.com/_functions/myFunction/John/Doe // or: // https://user.wixsite.com/mysite/_functions/myFunction/John/Doe export function get_myFunction(request) { let options = { "headers": { "Content-Type": "application/json" } }; // query a collection to find matching items return wixData.query("myUsersCollection") .eq("firstName", request.path[0]) .eq("lastName", request.path[1]) .find() .then( (results) => { // matching items were found if(results.items.length > 0) { options.body = { "items": results.items }; return ok(options); } // no matching items found options.body = { "error": `'${request.path[0]} ${request.path[1]}' was not found` }; return notFound(options); } ) // something went wrong .catch( (error) => { options.body = { "error": error }; return serverError(options); } ); } ``` ---