Code Monkey home page Code Monkey logo

linklist's Introduction

LinkList

Stores a list of links. Actually, it stores a list of items that may optionally contain a link. Every item contains a title, and optionally: link, notes, image, tags.

The frontend is being developed now in React Native (previously it was in Vue).

Technologies used

React app

Instructions for ReactNative app:

  • Go to src/main/rn-app-new
  • Run it in dev mode with npm start
  • Use npm start-tunnel to use ngrok (could be insecure)
  • publish with eas update

Vue instructions

Development for Vue/API:

  • Run API from IDE or with ./mvnw compile quarkus:dev
    • I think that for local startup it's needed to load key by location from getPrivateKey in SecurityUtil.
  • Run Vue in dev mode from src/main/vue-app with npm run serve
    • By default, the Vue webapp is configured to connect to the real server
    • If you want to connect to localhost, change apiUrl in constants.js.

Deploy:

  • Build Vue/Docker:
    • ./build-vue.sh if you changed Vue
    • ./build-push-docker.sh (Docker desktop must be open)
  • Deploy on Heroku:
    • See deploy on Heroku, usually:
      • heroku container:push web
      • heroku container:release web
  • Old deploy on Render:
  • Check test endpoint.

Sample calls

SERVER=http://127.0.0.1:8070

# Register
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"username":"may", "password":"12345", "password2":"12345"}' \
  $SERVER/security/register | jq

# Login
curl -X POST \
  -H "Content-Type: application/json" \
  -d '{"username":"may", "password":"12345"}' \
  $SERVER/security/login | jq

# Login and sets JWT variable
JWT=$(curl -X POST --silent \
  -H "Content-Type: application/json" \
  -d '{"username":"may", "password":"llistzz"}' \
  $SERVER/security/login | jq -r .token)

# Prepare params for the following calls
AUTH="Authorization: Bearer $JWT"
CONTENT_TYPE="Content-Type: application/json"
HEADERS="-H '$AUTH' -H '$CONTENT_TYPE'"
# Note that we always use POST (that's a personal choice)
COMMON_PARAMS = "-X POST $HEADERS"

# Upsert item
# TODO: Check that missing fields are initialized in server
curl $COMMON_PARAMS \
  -d '{"title":"item1", "tags":["tag1", "tag2"]}' \
  $SERVER/items/upsertOne | jq

# Search items
curl $COMMON_PARAMS \
  -d '{"username":"may"}' \
  $SERVER/items/search | jq

# Delete item
curl $COMMON_PARAMS \
  -d '{"id":"ITEM_ID"}' \
  $SERVER/items/deleteOne | jq

# Update many (for now just updates tags)
curl $COMMON_PARAMS \
  -d '{"tagsToSearch":["test"], "tagsToAdd":["added"], "tagsToRemove":[]}' \
  $SERVER/items/updateMany

How JWT keys were created

See: https://quarkus.io/guides/security-jwt#generating-a-jwt

openssl genrsa -out rsaPrivateKey.pem 2048
openssl rsa -pubout -in rsaPrivateKey.pem -out publicKey.pem
openssl pkcs8 -topk8 -nocrypt -inform pem -in rsaPrivateKey.pem -outform pem -out privateKey.pem
  • publicKey.pem is referenced in application.properties, mp.jwt.verify.publickey.location.
  • privateKey.pem is passed as an env var smallrye.jwt.sign.key-location (although this is deprecated).

Original README:

This project uses Quarkus, the Supersonic Subatomic Java Framework.

If you want to learn more about Quarkus, please visit its website: https://quarkus.io/ .

Running the application in dev mode

You can run your application in dev mode that enables live coding using:

./mvnw compile quarkus:dev

NOTE: Quarkus now ships with a Dev UI, which is available in dev mode only at http://localhost:8080/q/dev/.

Packaging and running the application

The application can be packaged using:

./mvnw package

It produces the quarkus-run.jar file in the target/quarkus-app/ directory. Be aware that it’s not an über-jar as the dependencies are copied into the target/quarkus-app/lib/ directory.

If you want to build an über-jar, execute the following command:

./mvnw package -Dquarkus.package.type=uber-jar

The application is now runnable using java -jar target/quarkus-app/quarkus-run.jar.

Creating a native executable

You can create a native executable using:

./mvnw package -Pnative

Or, if you don't have GraalVM installed, you can run the native executable build in a container using:

./mvnw package -Pnative -Dquarkus.native.container-build=true

You can then execute your native executable with: ./target/linklist-1.0.0-SNAPSHOT-runner

If you want to learn more about building native executables, please consult https://quarkus.io/guides/maven-tooling.html.

Provided examples

RESTEasy JSON serialisation using Jackson

This example demonstrate RESTEasy JSON serialisation by letting you list, add and remove quark types from a list. Quarked!

Related guide section...

linklist's People

Contributors

fmaylinch avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.