박은주

flask -> node

1 +const http = require('http');
2 +const express = require('express')
3 +const fs = require('fs');
4 +const path = require('path');
5 +const { rawListeners } = require('process');
6 +var port = 23023;
7 +
8 +var app = express();
9 +var router = require('./index')(app);
10 +
11 +app.set('port', port);
12 +app.set('views', __dirname + '/static');
13 +app.set('view engine', 'ejs');
14 +app.engine('html', require('ejs').renderFile);
15 +
16 +app.use(express.static(__dirname + '/static'));
17 +
18 +var server = http.createServer(app).listen(port, function(){
19 + console.log("Server Running . . .");
20 +})
...\ No newline at end of file ...\ No newline at end of file
1 -import schedule
2 -
3 -from flask import Flask, render_template
4 -
5 -from SentimentAnalyzer import StartSentimentAnalysis
6 -from content import GetData
7 -
8 -app = Flask(__name__)
9 -
10 -@app.route('/')
11 -def main():
12 - schedule.every().day.at("08:00").do(GetData())
13 - tot, positive, neutral, negative = StartSentimentAnalysis()
14 - return render_template('index.html', data = {
15 - 'total' : tot,
16 - 'positive' : int(positive / tot * 100),
17 - 'neutral' : int(neutral / tot * 100),
18 - 'negative' : int(negative / tot * 100),
19 - })
20 -
21 -if __name__ == "__main__":
22 - app.run(port="23023", debug=True)
23 - # host 등을 직접 지정하고 싶다면
24 - # app.run(host="127.0.0.1", port="5000", debug=True)
...\ No newline at end of file ...\ No newline at end of file