Skip to content

Node API with support for reading/writing spatial data, built with Express, Auth0, and TypeScript.

Notifications You must be signed in to change notification settings

nzjs/spatial-api-auth0-ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Info

Node API for working with spatial datasets in Postgres. Built with Express, Auth0, and TypeScript.
It has built in authentication using Auth0, and supports reading and writing geospatial datasets.

Requirements

  1. Install TypeScript + compiler (tsc) via npm.

  2. Clone the repo, navigate to the root directory and install via npm.

npm install
  1. Import the sample .sql database into your Postgres environment.

  2. Create the respective variables in your .env file

PORT=9000
AUTH0_DOMAIN=
AUTH0_AUDIENCE=
DB_SERVER=
DB_PORT=
DB_DBNAME=
DB_USERNAME=
DB_PASSWORD=

Usage

  1. Run a development server using the dev script
npm run dev
  1. Run a production server using the prod script after compiling index.js
npm run build
npm run prod

Don't forget to configure PM2 or a similar process manager for production.

API Endpoints

Sample json data for creating/updating data is included in the /tests folder.

Pass a valid Auth0 token in the header of all requests to the API endpoints.
Authentication: Bearer <token>

Endpoint - POIs - Points of interest data

Get all pois for user
GET /api/v1/spatial/pois

Get all pois for user as geojson feature collection
GET /api/v1/spatial/pois?f=geojson

Get a single poi using an id parameter
GET /api/v1/spatial/pois/:id

Create a new poi
POST /api/v1/spatial/pois

Update a poi using an id parameter
PUT /api/v1/spatial/pois/:id

Remove a poi using an id parameter
DELETE /api/v1/spatial/pois/:id

Endpoint - Tracks - Polyline route track data

Get all tracks for user
GET /api/v1/spatial/tracks

Get a single route using an id parameter
GET /api/v1/spatial/tracks/:id

Create a new route
POST /api/v1/spatial/tracks

Update a route using an id parameter
PUT /api/v1/spatial/tracks/:id

Remove a route using an id parameter
DELETE /api/v1/spatial/tracks/:id

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

Please make sure to update tests as appropriate.

License

MIT

About

Node API with support for reading/writing spatial data, built with Express, Auth0, and TypeScript.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published