Skip to content
This repository has been archived by the owner on Oct 1, 2024. It is now read-only.

static file response with regex #1

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
38 changes: 8 additions & 30 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,32 @@ app.get('/', function (req, res) {
res.sendfile( __dirname + '/front/index.html');
});

app.get('/form.css', function (req, res) {
res.sendfile( __dirname + '/front/form.css');
});

app.get('/form.js', function (req, res) {
res.sendfile( __dirname + '/front/form.js');
});

app.get('/intro', function (req, res) {
res.sendfile( __dirname + '/front/intro.html');
});

app.get('/intro.js', function (req, res) {
res.sendfile( __dirname + '/front/intro.js');
});

app.get('/notice', function (req, res){
res.sendfile( __dirname + '/front/notice.html');
});

app.get('/notice.css', function (req, res){
res.sendfile( __dirname + '/front/notice.css');
});

app.get('/notice.js', function (req, res){
res.sendfile( __dirname + '/front/notice.js');
});

app.get('/jquery', function (req, res){
res.sendfile( __dirname + '/front/jquery-1.11.1.js');
app.get(/\/.*.css/, function(req, res){
res.sendFile(__dirname + "/front"+req.path);
});


app.get('/res/logo.png', function (req, res){
res.sendfile( __dirname + '/front/res/logo.png');
app.get(/\/.*.js/, function(req, res){
res.sendFile(__dirname + "/front"+req.path);
});

app.get('/res/login.png', function (req, res){
res.sendfile( __dirname + '/front/res/login.png');
app.get(/\/.*.png/, function(req, res){
res.sendFile(__dirname + "/front"+req.path);
});

app.get('/res/banner.png', function (req, res){
res.sendfile( __dirname + '/front/res/banner.png');
app.get('/jquery', function (req, res){
res.sendfile( __dirname + '/front/jquery-1.11.1.js');
});



var server = app.listen(process.env.PORT||3000, function () {

var host = server.address().address;
Expand All @@ -61,4 +40,3 @@ var server = app.listen(process.env.PORT||3000, function () {
console.log('Example app listening at http://%s:%s', host, port);

});