-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of github.com:HiAlcohol/HiAlcohol_server
- Loading branch information
Showing
3 changed files
with
166 additions
and
103 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
const express = require('express'); | ||
const router = express.Router(); | ||
const search_list = require('../template/search_list.js'); | ||
const mysql = require('mysql'); | ||
|
||
router.get('/', function(request, response) { | ||
const body = search_list.HOME(); | ||
response.send(search_list.HTML(body)); | ||
var url = require('url'); | ||
|
||
var db = mysql.createConnection({ | ||
host:'localhost', | ||
user:'root', | ||
password:'root', | ||
database:'hialcohol' | ||
}); | ||
db.connect(); | ||
|
||
router.get('/', function(request, response){ | ||
db.query(`select * from recipe`, function(err, result){ | ||
if (err) throw err; | ||
var id = result[0].id; | ||
var cocktail = result[0].cocktail; | ||
|
||
var list = search_list.LIST(result) | ||
var html = search_list.HTML(id, cocktail, list) | ||
|
||
response.send(html); | ||
}); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters