Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix examples #11

Merged
merged 2 commits into from
Jan 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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