최원석3 [goesnow]

edit routing

1 -# check your instagram! 1 +# Check your instagram!
2 2
3 -``` 3 +Lookup ID, and Compare!
4 +
5 +## Execute server
6 +```shell
4 python -m pipenv shell 7 python -m pipenv shell
8 +python server.py
5 ``` 9 ```
10 +
11 +## Execute only frontend
12 +
13 +[link](https://github.com/1Seok2/check-your-instagram/tree/master/app)
......
...@@ -16,3 +16,8 @@ npm run start ...@@ -16,3 +16,8 @@ npm run start
16 ``` 16 ```
17 17
18 `npm run start`만 진행할 시 수정사항이 적용되지 않음 18 `npm run start`만 진행할 시 수정사항이 적용되지 않음
19 +
20 +### 최종 빌드 진행
21 +```shell
22 +npm run predeploy
23 +```
...\ No newline at end of file ...\ No newline at end of file
......
1 -
2 -const gulp = require('gulp');
3 -const browserify = require('browserify');
4 -const watchify = require('watchify');
5 -const errorify = require('errorify');
6 -const del = require('del');
7 -const tsify = require('tsify');
8 -const source = require('vinyl-source-stream');
9 -const buffer = require('vinyl-buffer');
10 -const runSequence = require('run-sequence');
11 -const uglify = require('gulp-uglify');
12 -
13 -gulp.task('clean', () => {
14 - return del('./built/**/*')
15 -});
16 -
17 -gulp.task('prod', () => {
18 - browserify({
19 - basedir: '.',
20 - debug: true,
21 - entries: ['src'],
22 - cache: {},
23 - packageCache: {}
24 - })
25 - .plugin(tsify)
26 - .bundle()
27 - .pipe(source('bundle.js'))
28 - .pipe(buffer())
29 - .pipe(uglify())
30 - .pipe(gulp.dest('built'));
31 -});
32 -
33 -gulp.task('dev', () => {
34 - browserify({
35 - basedir: '.',
36 - debug: true,
37 - entries: ['src'],
38 - cache: {},
39 - packageCache: {}
40 - })
41 - .plugin(tsify)
42 - .plugin(watchify)
43 - .plugin(errorify)
44 - .bundle()
45 - .pipe(source('bundle.js'))
46 - .pipe(gulp.dest('built'));
47 -});
48 -
49 -gulp.task('default', (done) => {
50 - runSequence('clean', 'dev', () => {
51 - console.log('Watching...')
52 - gulp.watch(['src/**/*.ts'],
53 - ['dev']);
54 - });
55 -});
56 -
57 -gulp.task('package', (done) => {
58 - runSequence('clean', 'prod', () => {
59 - console.log('Watching...')
60 - gulp.watch(['src/**/*.ts'],
61 - ['prod']);
62 - });
63 -});
...@@ -19,7 +19,8 @@ ...@@ -19,7 +19,8 @@
19 "posttest": "npm.cmd run lint", 19 "posttest": "npm.cmd run lint",
20 "compile": "tsc -w", 20 "compile": "tsc -w",
21 "build": "webpack --watch", 21 "build": "webpack --watch",
22 - "start": "webpack serve --open" 22 + "start": "webpack serve --open",
23 + "predeploy" : "webpack"
23 }, 24 },
24 "devDependencies": { 25 "devDependencies": {
25 "@types/node": "^14.11.2", 26 "@types/node": "^14.11.2",
......
1 import os 1 import os
2 from flask import Flask, render_template, request, jsonify, send_from_directory 2 from flask import Flask, render_template, request, jsonify, send_from_directory
3 -
4 from crawler.crawler_instagram import crawler_instagram 3 from crawler.crawler_instagram import crawler_instagram
5 4
6 app = Flask(__name__) 5 app = Flask(__name__)
7 6
8 -
9 @app.errorhandler(404) 7 @app.errorhandler(404)
10 def page_not_found(): 8 def page_not_found():
11 return render_template('404.html') 9 return render_template('404.html')
12 10
13 11
14 -@app.route("/") 12 +def update(insta_id):
15 -def home():
16 - # return render_template('index.html')
17 - return send_from_directory('./app','index.html')
18 -
19 -
20 -@app.route("/update", methods=["GET"])
21 -def update():
22 - insta_id = request.args.get('insta_id')
23 crawler_instagram(insta_id) 13 crawler_instagram(insta_id)
24 14
25 data = { 15 data = {
...@@ -27,9 +17,16 @@ def update(): ...@@ -27,9 +17,16 @@ def update():
27 } 17 }
28 return jsonify(data) 18 return jsonify(data)
29 19
30 -@app.route("/hello", methods=["GET"]) 20 +
31 -def hello(): 21 +@app.route("/", defaults={"path": ""})
32 - return "hello" 22 +@app.route("/<path:path>")
23 +def home(path):
24 + # return render_template('index.html')
25 + if path == 'update':
26 + insta_id = request.args.get('insta_id')
27 + update(insta_id)
28 + else :
29 + return send_from_directory('./app/public/', 'index.html')
33 30
34 31
35 if __name__ == "__main__": 32 if __name__ == "__main__":
......