{"id":25944990,"url":"https://github.com/path-check/safeplaces-backend-lib","last_synced_at":"2026-05-05T13:35:22.047Z","repository":{"id":42721440,"uuid":"274195047","full_name":"Path-Check/safeplaces-backend-lib","owner":"Path-Check","description":"SafePlaces Backend server Library that is used to power the Backend, Ingest, and Translation API's.","archived":false,"fork":false,"pushed_at":"2022-12-13T12:01:11.000Z","size":140,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-04-24T06:07:09.043Z","etag":null,"topics":["express","helper","non-critical"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Path-Check.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-22T16:56:45.000Z","updated_at":"2024-04-24T06:07:09.044Z","dependencies_parsed_at":"2023-01-28T12:01:26.766Z","dependency_job_id":null,"html_url":"https://github.com/Path-Check/safeplaces-backend-lib","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fsafeplaces-backend-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fsafeplaces-backend-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fsafeplaces-backend-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Path-Check%2Fsafeplaces-backend-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Path-Check","download_url":"https://codeload.github.com/Path-Check/safeplaces-backend-lib/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241810080,"owners_count":20023899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["express","helper","non-critical"],"created_at":"2025-03-04T08:20:33.571Z","updated_at":"2026-05-05T13:35:16.989Z","avatar_url":"https://github.com/Path-Check.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SafePlaces Server Library\n\nThe SafePlaces Server library is a pre-built Express server used across all SafePlaces services. A full example of how to integrate this library into an existing service can be found in the `sample/` directory.\n\n## Environment Variables\n\nA single environment variable is required to configure the port that the server should run on.\n\n```\nEXPRESSPORT=3000\n```\n\n## Installation and Usage\n\nInstall with npm or yarn\n\n```\nnpm install @pathcheck/safeplaces-server\n\n-or-\n\nyarn add @pathcheck/safeplaces-server\n```\n\nOnce installed, create an `app.js` file at the root level and add the following:\n\n```\nconst path = require('path');\n\nconst config = {\n  port: process.env.EXPRESS_PORT || '3000',\n  bind: '127.0.0.1',\n  appFolder: path.join(__dirname, 'app'),\n  wrapAsync: (asyncFn, validate = false) =\u003e {\n    return (req, res, next) =\u003e {\n      if (validate) {\n        // Do some sort of validation here.\n      }\n      asyncFn(req, res, next).catch(next);\n    };\n  },\n};\n\nconst server = require('@pathcheck/safeplaces-server')(config);\nconst enforcer = require('./app/lib/auth');\n\nserver.setupAndCreate();\n\nmodule.exports = server;\n\n```\n\n### Options\n\nThe following are a list of options that can be passed to the server for further customization:\n\n- `port`: port to run the server on\n- `bind`: bind address\n- `appFolder`: folder where your application logic exists\n- `wrapAsync`: method for handling async/await methods within routes.  Will also handle validation.\n\n### Starting the server\n\nBelow is example code of how to start the server (normally located in `bin/www`).\n\n```\n#!/usr/bin/env node\n\nrequire('dotenv').config()\n\nconst server = require('../app');\n\nserver.start()\n```\n\n### Routes\n\nBelow is example code of how to add a route to the server.\n\n```\nconst { router } = require('../../../app');\nconst controller = require('./controller');\n\nrouter.post(\n  '/signup',\n  router.wrapAsync(\n    async (req, res) =\u003e await controller.signupAction(req, res),\n    true,\n  ),\n);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpath-check%2Fsafeplaces-backend-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpath-check%2Fsafeplaces-backend-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpath-check%2Fsafeplaces-backend-lib/lists"}