Linksort is an open source bookmarking application.
Setting up your development environment is easy. Make sure you have docker
and docker-compose
installed and run the following command from the root of this repository.
docker-compose up
That's it! Go to http://localhost:8000 to find the app up and running. Whenever you change a file, the code we be automatically recompiled and run.
Sometimes you need to develop without being inside a Docker container. Follow these steps to run the project in development mode without Docker.
You'll need a access to a mongodb endpoint that supports replica sets. You can build and run a docker image that provides such an endpoint by running the following commands.
# Build the image.
docker build -f docker/mongo.Dockerfile -t mongo-rs .
# Run it in the background.
docker run -p 27017:27017 -v db-data:/data/db -d mongo-rs
Run air
to start the backend server. This also starts a watcher that automatically rebuilds and runs the server whenever changes are detected. You'll also need to set the following environment variables.
export PRODUCTION=0
export ANALYZER_KEY=$(cat /path/to/key) # Optional
export FRONTEND_HOSTNAME=localhost
export FRONTEND_PORT=3000
air
Open another terminal window and start the frontend. This server also starts a watcher that supports hot module replacement.
cd frontend
yarn start
Go to http://localhost:8080.
# Build the mongo image.
docker build -f docker/mongo.Dockerfile -t mongo-rs .
# Run it. Note db-data2 and db2.
docker run -p 27017:27017 -v db-data2:/data/db2 -d mongo-rs
# Run tests. No need to repeat the previous steps for subsequent runs.
go test ./...
docker build -f ./docker/main.Dockerfile -t ls .
docker run -e ANALYZER_KEY="$ANALYZER_KEY" -e DB_CONNECTION="mongodb://172.17.0.2:27017/?connect=direct" -p 8080:8080 ls
# Make sure swag is installed.
go install github.com/swaggo/swag/cmd/swag@latest
# Generate docs.
swag init --dir cmd/serve/,handler,model,payload