• Stars
    star
    117
  • Rank 301,828 (Top 6 %)
  • Language
    Elm
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Server-side Elm

Servelm - Elm Http Server

Deprecated. Server side elm is not designed to work this way.

This server, along with rtfeldman's Elm stylesheets, means that we can now have full stack Elm support. At no point in the development of an application will you have to write anything other than Elm!

It now supports server-side rendering of elm-html.

A demo can be found here. The styling is done through compile-time correct CSS provided by elm-stylesheets.

APIs exposed

The Http.Server module allows you to create servers and run them.

Sending out Elm

Use the Http.Response.writeElm function to compile an Elm file on request. It will compile an Elm file found with name + ".elm"". It will write the output to a file in the same folder as name + ".html". This will then be served out to the client. There is basic caching involved at the moment, which works based on the lifecycle of the server. Restart the server if you make any changes.

This is enabled by the node-elm-compiler package.

It also supports server-side rendering of elm-html, through using the vdom-to-html package.

Get started

To start Elm inside of Node simply this to the end of your compiled Elm code.

Elm.worker(Elm.Main);

Take a look at example/run.sh to see a complete usage

elm make example/server/Main.elm --output=example/main.js
echo "Elm.worker(Elm.Main);" >> example/main.js
node example/main.js

Run the example

This project depends on Node.js and the node command.

example/run.sh

Then load up the browser to see it working!

Credit

Originally inspired by https://github.com/Fresheyeball/elm-http-server.

There was some great work already there, I just cleaned it up a little and integrated it with some other packages.

More Repositories

1

take-home

A take-home application server written in Elm and only Elm
Elm
359
star
2

derw

An Elm-inspired language that transpiles to TypeScript
TypeScript
330
star
3

json-to-elm

Create Elm type aliases and decoders based on JSON input
Elm
279
star
4

elm-blogger

A blogging platform written in Elm + Elixir
Elixir
102
star
5

elm-server-side-renderer

Render elm on the server
Elm
99
star
6

elm-static-html

Statically render html from Elm!
JavaScript
89
star
7

elm-static-site

Static site generator using Elm
JavaScript
87
star
8

elm-phoenix

Phoenix helpers for Elm
Elm
74
star
9

elm-html-test

Test elm-html in Elm!
Elm
68
star
10

haskell-to-elm

68
star
11

elm-for-web-developers

A collection of tips for people using Elm from a web-dev background
56
star
12

elm-static-html-lib

TypeScript
56
star
13

elm-ffi

An FFI interface for Elm
Elm
50
star
14

elmxir

Interop tools for working with Elm in Elixir
Elixir
46
star
15

elm-all-dict

A dict for Elm which can store any type
Elm
37
star
16

elm-bash-completion

Bash completion for Elm
Shell
27
star
17

elm-init-scripts

Python
25
star
18

elm-fuse

Fuse support in Elm
Elm
24
star
19

elm-sketch-importer

Generate Elm code from Sketch files!
Elm
22
star
20

elm-proper-install

Properly install things from Github for Elm
JavaScript
16
star
21

make-your-own-tea

A step-by-step guide to making your own Elm architecture in TypeScript
Shell
15
star
22

coed

Elm-style library for writing modern frontends
TypeScript
15
star
23

neuro-lingo

A language where you only implement comments
TypeScript
13
star
24

elm-flat-matrix

Flat matrix implementation for Elm
Elm
12
star
25

elm-html-in-elm

Elm
12
star
26

elm-alternative-json

An alternative to core's JSON decoder
Elm
12
star
27

elm-xml

xml parser for elm
Elm
11
star
28

hiraeth

Shell
10
star
29

elm-lazy

Elm
10
star
30

elm-run-worker

Run Elm files in worker mode from the CLI
JavaScript
8
star
31

elm-dom-tests

Test dom things
JavaScript
8
star
32

elm-flasked

Elm
8
star
33

sass-to-elm

Elm
7
star
34

slack-today-i-did

Python
7
star
35

meta-elm

Examples of doing meta programming Elm, which you shouldn't do
Elm
7
star
36

elm-http-server

A HTTP server for Elm
Elm
7
star
37

elm-debug-json-view

A package for debugging a decoders with Json in Elm
Elm
6
star
38

stalk

stack-based language written in Elm
Elm
6
star
39

relm

Use react alongside elm
JavaScript
6
star
40

elm-help

JavaScript
6
star
41

elm-debug-decoders

A tool for debugging decoders
JavaScript
6
star
42

elm-package-for-production

Python
5
star
43

pycho

A game engine with inbuilt AI support written for Python 2 and 3.
Python
5
star
44

elm-node-elm-compiler

Elm compiler via Node
Elm
5
star
45

idris-hangman

Example of hangman in Idris
Idris
5
star
46

adeilad

Ensure JSON has the correct structure at runtime
TypeScript
4
star
47

elm-html-query

Elm
4
star
48

the-elm-report

A presentation on the state of Elm
JavaScript
4
star
49

elm-http-error-view

A generic view component
Elm
4
star
50

post-install-elm

Use NPM for managing elm deps
JavaScript
4
star
51

broken-clock

A broken clock used as examples for Elm
Elm
4
star
52

elm-macros

Python
3
star
53

elm-phoenixed

HTML
3
star
54

drawea

Elm
3
star
55

PyChat.js

A chat system built around graceful-websockets and tornado
JavaScript
3
star
56

elm-json-field-value

Elm
3
star
57

BigSister

Extendable IRC bot framework
Python
3
star
58

elm-test-runner

Python
3
star
59

elm-debounce-effects

An effect manager for dealing with debouncing
Elm
3
star
60

elm-query

JQuery for Elm
Elm
3
star
61

elm-diff

Elm
3
star
62

elm-stringify

DEPRECATED: no use
JavaScript
3
star
63

elm-game-of-games

Game of life in Elm
Elm
3
star
64

elm-shrink

Elm
2
star
65

elm-to-elixir

Elm
2
star
66

react-to-elm

Convert React components to Elm
2
star
67

elm-lint

Elm
2
star
68

fedora-matlab

Web challenge
2
star
69

PyGeo2

A project to continue maintaining PyGeo and bring it up to date
2
star
70

ts-core

Some core data structures and functions for typescript
TypeScript
2
star
71

code-golf

collection of code-golfs solutions from our code-golf club
Python
2
star
72

elm-lazy-list

Elm
2
star
73

talks

Various talks I've done
JavaScript
2
star
74

advent-of-code-2016

Idris
2
star
75

caching-layer-docker

Docker files for the elm caching layer
Shell
2
star
76

elm-default-dict

A dict implementation which allows you to provide a default value to use
Elm
1
star
77

SimpleGames

Simple games from Atari implemented in various languages.
Python
1
star
78

realrpg

Python
1
star
79

the-new-turing-omnibus

Elm
1
star
80

elm-uno

An Uno-to-x compiler written in Elm
Elm
1
star
81

mountain-path

Elm
1
star
82

ovas-2

C++
1
star
83

ts-list-zipper

TypeScript
1
star
84

relearn-yourself-a-java

A set of questions used to reteach Java to students.
Java
1
star
85

css-reactor

Elm
1
star
86

elm-safe-regex

JavaScript
1
star
87

Fuze

Elm
1
star
88

NetlogoSims

Simulations written using Netlogo
NetLogo
1
star
89

bach

TypeScript
1
star
90

newer-paper

Elm
1
star
91

ProcessingVisualizations

Python
1
star
92

elm-full-stack

1
star
93

baner

Flag parsing library in Typescript
TypeScript
1
star
94

fontbomber

A clone of https://github.com/code-curve/font-bomb, but written in Python
Python
1
star
95

SourceUploader

Simple uploader for files to gist
1
star
96

mainc

A simple, small benchmarking library for Node
TypeScript
1
star
97

LudumDare28

A game written for LudumDare28
Python
1
star
98

lets-write-elm

Elm
1
star
99

ArdLib

Arduino libraries and general programs with diagrams
1
star
100

elm-graphql-debug-errors

Elm
1
star