Skip to content

Commit

Permalink
chore: fix examples (#11)
Browse files Browse the repository at this point in the history
* chore: fix examples

* fixes formatting
  • Loading branch information
joeyguerra authored Jan 20, 2024
1 parent 03f5bd1 commit ec01683
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 19 deletions.
15 changes: 8 additions & 7 deletions examples/search/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var express = require('../..');
var path = require('path');
var redis = require('redis');

var db = redis.createClient();
var db = redis.createClient()

// npm install redis

Expand All @@ -24,12 +24,13 @@ var app = express();
app.use(express.static(path.join(__dirname, 'public')));

// populate search

db.sadd('ferret', 'tobi');
db.sadd('ferret', 'loki');
db.sadd('ferret', 'jane');
db.sadd('cat', 'manny');
db.sadd('cat', 'luna');
db.on('ready', function(){
db.sAdd('ferret', 'tobi');
db.sAdd('ferret', 'loki');
db.sAdd('ferret', 'jane');
db.sAdd('cat', 'manny');
db.sAdd('cat', 'luna');
});

/**
* GET search for :query.
Expand Down
15 changes: 9 additions & 6 deletions examples/static-files/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ app.use('/static', express.static(path.join(__dirname, 'public')));
// this will allow "GET /style.css" instead of "GET /css/style.css":
app.use(express.static(path.join(__dirname, 'public', 'css')));

app.listen(process.env.PORT || 3000);
console.log(`listening on port ${process.env.PORT || 3000}`);
console.log('try:');
console.log(' GET /hello.txt');
console.log(' GET /js/app.js');
console.log(' GET /css/style.css');
if (!require.main) {
const server = app.listen();
app.close = () => server.close();
console.log(`Express started on port ${server.address().port}`);
console.log('try:');
console.log(' GET /hello.txt');
console.log(' GET /js/app.js');
console.log(' GET /css/style.css');
}
114 changes: 108 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@
"method-override": "^3.0.0",
"morgan": "^1.10.0",
"multiparty": "^4.2.3",
"online": "^0.0.1",
"pbkdf2-password": "^1.2.1",
"redis": "^4.6.12",
"supertest": "^6.3.3",
"vhost": "^3.0.2"
},
Expand Down

0 comments on commit ec01683

Please sign in to comment.