Switch back to a Go server. Planned: HTMX for dynamic stuff

This commit is contained in:
Samantha Becker 2023-09-17 16:28:54 +02:00
parent 89c766afda
commit 0bf746cf54
16 changed files with 46 additions and 121 deletions

8
.idea/.gitignore vendored Normal file
View file

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

9
.idea/evilthings.iml Normal file
View file

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

8
.idea/modules.xml Normal file
View file

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/evilthings.iml" filepath="$PROJECT_DIR$/.idea/evilthings.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml Normal file
View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>

3
go.mod Normal file
View file

@ -0,0 +1,3 @@
module gitlab.com/evilthings-services/evilthings
go 1.20

12
main.go Normal file
View file

@ -0,0 +1,12 @@
package main
import "net/http"
func main() {
http.HandleFunc("/", handleRoot)
http.ListenAndServe("0.0.0.0:8000", nil)
}
func handleRoot(w http.ResponseWriter, r *http.Request) {
}

View file

@ -1,29 +0,0 @@
{
"name": "evilthings",
"version": "0.0.41",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"check": "svelte-kit sync && svelte-check --tsconfig tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig tsconfig.json --watch"
},
"devDependencies": {
"@sveltejs/adapter-auto": "^1.0.0",
"@sveltejs/kit": "^1.0.12",
"svelte": "^3.55.1",
"svelte-check": "^2.10.2",
"svelte-preprocess": "^5.0.0",
"tslib": "^2.4.1",
"typescript": "^4.9.4",
"vite": "^4.0.4"
},
"type": "module",
"dependencies": {
"@bun-community/sveltekit-adapter-bun": "^0.0.6",
"@rollup/plugin-commonjs": "^24.0.0",
"@rollup/plugin-json": "^6.0.0",
"@rollup/plugin-node-resolve": "^15.0.1",
"rollup": "^3.7.5"
}
}

9
src/app.d.ts vendored
View file

@ -1,9 +0,0 @@
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
// and what to do when importing types
declare namespace App {
// interface Locals {}
// interface PageData {}
// interface Error {}
// interface Platform {}
}

View file

@ -1,12 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width" />
%sveltekit.head%
</head>
<body>
<div>%sveltekit.body%</div>
</body>
</html>

View file

@ -1 +0,0 @@
<div style="background: #CCC"><slot /></div>

View file

@ -1,8 +0,0 @@
<head>
<title>Evilthings</title>
</head>
<h1>Welcome to Evilthings</h1>
<p>
A mantle thing for software things m* does. Could possibly, but unlikely, be extended in the future.
</p>

View file

@ -1,20 +0,0 @@
import { error } from "@sveltejs/kit";
/** @type {import('./$types').RequestHandler} */
export function GET({ url }: { url: URL }) {
const min = Number(url.searchParams.get("min") ?? "0");
const max = Number(url.searchParams.get("max") ?? "11");
const d = max - min;
if (isNaN(d) || d < 0) {
throw error(
400,
"min and max must be numbers, and min must be less than max"
);
}
const random = min + Math.random() * d;
return new Response(String(random));
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

View file

@ -1,17 +0,0 @@
import adapter from "@bun-community/sveltekit-adapter-bun";
import preprocess from "svelte-preprocess";
/** @type {import('@sveltejs/kit').Config} */
const config = {
// Consult https://github.com/sveltejs/svelte-preprocess
// for more information about preprocessors
preprocess: preprocess(),
kit: {
adapter: adapter({
dynamic_origin: true,
}),
},
};
export default config;

View file

@ -1,17 +0,0 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true
}
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias
//
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
// from the referenced tsconfig.json - TypeScript does not merge them in
}

View file

@ -1,8 +0,0 @@
import { sveltekit } from "@sveltejs/kit/vite";
import type { UserConfig } from "vite";
const config: UserConfig = {
plugins: [sveltekit()],
};
export default config;