Build a website that prints a random epigram on every refresh (like the
fortune
command-line tool, but on the web).
Build an HTML page that dynamically loads a random epigram from your server, and build a backend in java to support it.
- Import the SQL file
database/epigram.sql
into your database - Update the database connection strings in
src/resources/application.properties
- Update the API endpoint in
src/resources/static/js/app.js
if necessary
Method | URI | Attributes | Description |
---|---|---|---|
GET | /epigram | Get all epigrams | |
GET | /epigram/random | Get a random epigram | |
GET | /epigram/{id} | Get an epigram by id | |
POST | /epigram | content: string | Create a new epigram |
PUT | /epigram/{id} | content: string | Update the content of an epigram |
DELETE | /epigram/{id} | Delete an epigram by id |
Code | Description |
---|---|
200 | Everything OK |
400 | Invalid request due to missing parameter(s) |
404 | Resource not found |
405 | Method not allowed |
50x | Server Internal Error |
Table epigram
Column | Datatype | Description |
---|---|---|
id | bigint | Auto increment id |
content | text | The epigram content |
created_at | datetime | The creation time of the row |
updated_at | datetime | The update time of the row |
The epigram data is from shlomif/fortune-mod
Back-end: Java Spring Boot
ORM: Hibernate
Front-end: Bootstrap 5, Vue.js 3
Junyan Li (i@jybb.me)