https://github.com/nicolasgandrade/api-link-sharing
https://github.com/nicolasgandrade/api-link-sharing
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nicolasgandrade/api-link-sharing
- Owner: nicolasgandrade
- Created: 2025-01-04T17:45:50.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2025-01-16T00:38:57.000Z (5 months ago)
- Last Synced: 2025-01-16T00:56:06.891Z (5 months ago)
- Language: TypeScript
- Size: 181 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# API Link Sharing
API for a link-sharing app like LinkTree or Beacons.
## Setting up the dev server
This project relies in Auth0 authorization/authentication. That said, to run your local instance of this app, you should create a new API project in [Auth0](https://auth0.com/) and fill up the environment varibales (see the `example.env` file) related to auth0.
To run the server, make sure you have `Docker` and `docker compose` installed in your machine.
Create an `.env` file following the `example.env` template and replace the missing variables with the database info (you can check the `docker-compose.yml` file for more details).
Run `docker compose --env-file .env -f docker-compose.dev.yml up` command. This will start the containers for the NodeJS app and the PostgreSQL database.
## Endpoints
GET / PUT Pages by the user's ID.
These endpoints will retrive and update pages based in the user id.
`/user/:userId/page`GET
This endpoint retrieves a page by its slug.
`/pages/:slug`## Running your own instance
To run your instace, you can modify the production `Dockerfile`, `docker-compose.yml` and `ci.yml` files according to your needs, or you can reuse the existing ones making some small modifications.
Currently, the CI pipeline builds an image using the prod Dockerfile and pushes to my repo in Docker Hub based in a release created in the Github repo. That is, if I create a release with the tag `1.2.3`, the pipeline will build and push a new image to Docker Hub with the same tag (`1.2.3`) and will also update the image with the `latest` tag.
After having the updated image in the Docker Hub repo, I just need to pull it and run the docker-compose in the production server.