Skip to content

Commit e1a610b

Browse files
committed
First pass at a express hello world example
1 parent 4fee3ad commit e1a610b

File tree

5 files changed

+928
-0
lines changed

5 files changed

+928
-0
lines changed

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,17 @@
11
# express-hello-world
2+
23
Implements the Expressjs Hello World example to provide faster start deploying on Cyclic platform
4+
5+
6+
## Installation
7+
8+
- Fork this repo
9+
- Clone to your local
10+
- `npm install`
11+
12+
## Running
13+
14+
- `npm start`
15+
- Browser: `http://localhost:3443/some/path?q=query+one&q=second+query&single=value`
16+
- Commandline: `curl -i -XGET "http://localhost:3443/cmd/line-curl"
17+

app.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const express = require('express')
2+
const app = express()
3+
4+
app.get('/', (req, res) => {
5+
res
6+
.set('x-powered-by', 'cyclic-express')
7+
.send('Hello World!')
8+
})
9+
10+
app.use('*', (req,res) => {
11+
res
12+
.set('x-powered-by', 'cyclic-express')
13+
.json({
14+
msg: "Not strickly part of the hello world but you get the picture.",
15+
at: new Date().toISOString(),
16+
method: req.method,
17+
hostname: req.hostname,
18+
ip: req.ip,
19+
path: req.params[0],
20+
query: req.query,
21+
headers: req.headers,
22+
cookies: req.cookies,
23+
})
24+
})
25+
26+
module.exports.app = app

0 commit comments

Comments
 (0)