This is a simple web application that takes a "database" of hotels and enables users to create wishlists and sort the existing hotels. Since this is only a small prototype, there is no real database connection. the data is stored in-memory on the server. Restarting the server clears the wishlist data.
This project was built from a GitHub template project to set up a React app with TypeScript running on Deno. It uses Vite as the dev server and an oak http server on the backend to serve the built project.
- React with TypeScript on the frontend
- Vite for the development server
- Deno for server-side JavaScript/TypeScript
- Oak framework for building web applications
- Static file serving
- Router setup
To run this app, you will need to have Deno installed.
To install the dependencies for the frontend and backend, run the following command:
deno install
The app uses a Vite dev server to run in development mode. To start the dev server, run the following command:
deno run dev
To build the app for production, run the following command:
deno run build
The backend server uses Deno and the Oak framework to serve the built React app. To start the backend server, run the following command:
deno run serve
To run the tests, use the following command:
deno run test
.
├── client
│ ├── dist
│ ├── public
│ └── src
│ ├── App.tsx
│ └── main.tsx
└── server
├── main.ts
└── util
└── routeStaticFilesFrom.ts
App.tsx
: The main React componentmain.tsx
: The entry point for the React appmain.ts
: The entry point for the Deno serverrouteStaticFilesFrom.ts
: A utility function to serve static filesdist
: The output directory for the built React apppublic
: The public directory for the React app
The React app is contained in the client
directory. This is also where Vite
will install its dependencies and build the app.
There is a vite.config.ts
file in the root of the project that configures Vite
to build the app in the client/dist
directory and serve the app on port 3000
.
The deno.json
file contains the tasks to run the dev server, build the app,
and serve the app, along with the dependencies and the compiler configuration
required to use JSX and React.
The Deno server is contained in the server
directory. The server serves the
built React app from the client/dist
directory and listens on port 8000
.