This library to allow you to share files from a server with the outside world by generating download links.
Enjoy ! ❤️
- Setup
- [API reference](#api reference)
- [Known issues](#known issues)
First clone the repository
git clone git@github.com:chrisalexandrepena/itransfer-backend.git
create a new postgresql database then use the provided .env.dist file to create your own environment file
- APP_PORT: The port your app is going to be running on (defaults to 8080)
- ENV: dev or prod (defaults to dev)
- HOST: host url to prepend to your generated links
- SHARED_DIR: (optionnal) if you want to be able to generate links using a path relative to a specific directory instead of always using absolute paths
- POSTGRES_PORT: port to access your database
- POSTGRES_HOST: host of you database
- POSTGRES_USER: user to access your database
- POSTGRES_PASSWORD: password to access your database
- POSTGRES_DB: name of your database
you need to install typescript and gulp (optionnal) globally:
npm i -g typescript gulp
you can now install the project dependencies:
npm i
you can now build the app:
gulp
if you don't want to use gulp you may juste build your app using:
npm run build
#or
tsc
run the migrations:
npm run typeorm migration:run
your app is ready, start it using:
npm start
or however you prefer!
downloads the file linked to the given hash
returns all available links
generates a single download link, if multiple paths are submited they will be compressed in a single zip file. body params:
- filePaths: string[]
- expirationDate: (optional) ISOstring
generates individual links for each submitted paths. body params:
- filePaths: string[]
- expirationDate: (optional) ISOstring
deletes a link
deletes multiple links
The app expects the database to be able to generate uuid fields, sometimes the required addon isn't installed or activated. The package you need is called postgresql-11-postgis-3 (your version of postgresql and postgis may vary), check that it is installed. You can then activate it using
psql -d -c 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp";'
When running the app in docker, symlinks wont work unless: both the symlinks and their base files are mounted as volumes using the same absolute paths inside and outsite the container.