hoosat-create 1.3.5 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +74 -8
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Hoosat Create
2
2
 
3
- Hoosat create is a `npx` script that creates React 18.2 + Express 4.18 full-stack server side renderng ESM project for you, where you can use Typescript to build web applications. It uses [@Hoosat-Oy/hoosat-template](https://github.com/Hoosat-Oy/hoosat-template) to build React + Express project with SSR and Typescript.
3
+ Hoosat create is a `npx` script that creates React 18.2 full-stack server side rendering ESM project for you, where you can use Typescript to build web applications. It uses [@Hoosat-Oy/hoosat-template](https://github.com/Hoosat-Oy/hoosat-template) to build React project with SSR and Typescript.
4
4
 
5
5
  ## Command to run
6
6
 
@@ -12,18 +12,16 @@ npx hoosat-create@latest
12
12
 
13
13
  - React-helmet-async 1.3
14
14
  - React 18.2
15
- - Express 4.18
16
15
  - TypeScript 4.9.2
17
16
  - Webpack 5
18
- - Babel 7
19
17
  - Jest 27
20
18
 
21
19
  ## Features
22
20
 
23
- - Full-stack TypeScript application using React and Express.
21
+ - Full-stack TypeScript application using React and Node HTTP/HTTPS.
24
22
  - Includes working server side SEO with `react-helmet-async`
25
- - Supports ES modules for server-side and client-side code.
26
- - Configured with Webpack and Babel for production builds.
23
+ - Supports ES modules for server-side and client-side ```.
24
+ - Configured with Webpack for production builds.
27
25
  - Includes Jest for unit testing.
28
26
  - Includes example components and routes for getting started.
29
27
  - Includes HoosatUI as optional dependancy as git submodule.
@@ -31,13 +29,81 @@ npx hoosat-create@latest
31
29
  ## Scripts
32
30
 
33
31
  - `npm run dev`: Builds and runs the development version.
32
+ - This script concurrently executes the following commands:
33
+ - `npm run dev:build:client`: Builds the client in development mode and watches for file changes.
34
+ - `npm run dev:build:server`: Builds the server in development mode and watches for file changes.
35
+ - `npm run dev:run`: Starts the server with Nodemon to automatically restart it on file changes.
36
+
34
37
  - `npm run build`: Builds the production version.
38
+ - This script sequentially executes the following commands:
39
+ - `npm run build:client`: Builds the client in production mode.
40
+ - `npm run build:server`: Builds the server in production mode.
41
+
35
42
  - `npm run start`: Runs the production version.
43
+ - This script starts the server using the compiled production files.
44
+
36
45
  - `npm run test`: Runs test units with Jest.
46
+ - This script executes the test units using Jest.
37
47
 
38
- ## Join us
39
- [https://discord.gg/UXPFcPaPBg](Discord)
48
+ ## File structure
49
+
50
+ - `src/client`: Contains client-side ``` (React components, styles, etc.).
51
+ - `src/server`: Contains server-side ``` (Node HTTP/HTTPS routes, API routes, etc.).
52
+ - `src/common`: Contains common ```.
53
+ - `public`: Contains the bundle.js client ``` and public files for the project.
54
+ - `dist`: Contains production build output of server.
55
+
56
+ ## Node HTTP/HTTP server with server side router.
57
+
58
+ `src/server/core/server.ts` contains the source ```, it supports middlewares, wildcard routes and specific routes. There are middlewares currently for setting cors and static files.
59
+
60
+ ### Basic example
61
+
62
+ ```
63
+ import { createRouter, createServer, listen } from './core/server';
64
+ import { cors } from './core/cors';
65
+ import { assets } from './core/assets';
66
+ // Creating the router
67
+ const router = createRouter();
40
68
 
69
+ // Adding static file middleware
70
+ router.Middleware(assets("./public"));
41
71
 
72
+ // Creating a ping route
73
+ // For request and response we dont use wrappers for node http types and methods.
74
+ router.Get("/ping", (req: IncomingMessage, res: ServerResponse) => {
75
+ res.writeHead(20, { 'Content-Type': "text/plain" });
76
+ res.end("pong!");
77
+ });
42
78
 
79
+ // Now that the middleware and routes have been set the server must be created that handles the routes.
80
+ const server = createServer(router);
43
81
 
82
+ // Start listening on port 3000
83
+ const port = parseInt(process.env.PORT || "8080");
84
+ listen(server, port, () => {
85
+ console.log(`Server is running on port ${port.toString()}`);
86
+ });
87
+ ```
88
+
89
+
90
+ ## License
91
+ This template is licensed under the MIT License. Feel free to use it for your own projects or as a starting point for your own templates.
92
+
93
+ ## Message
94
+
95
+ I just dropped some dependancies from the repository and this will keep happening. With our own ``` we can keep it up to date with React and Node versions more easily.
96
+ Though for now the only goal seems to be to drop `react-helmet-async`.
97
+
98
+ ## Release changes
99
+
100
+ ### 1.4.0 -> 1.4.1
101
+ - Changed createServer to include options argument for changing server protocol and to include SSL certificate information.
102
+ - JSDoc has been added and more documentation work.
103
+
104
+ ### 1.3.5 -> 1.4.0
105
+ - Dropped Express.js and Babel from dependancies.
106
+ - Updated package.json scripts to use concurrently and nodemon.
107
+
108
+ ## Join us
109
+ [https://discord.gg/UXPFcPaPBg](Discord)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hoosat-create",
3
- "version": "1.3.5",
4
- "description": "Hoosat Oy React + Express.js Typescript SSR project template.",
3
+ "version": "1.4.1",
4
+ "description": "Hoosat - React & Typescript SSR project template.",
5
5
  "main": "index.js",
6
6
  "bin": {
7
7
  "hoosat-create": "index.js"