sungjin

Add README, Post Level Service

1 -This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). 1 +<div id="top"></div>
2 +<!--
3 +*** Thanks for checking out the Best-README-Template. If you have a suggestion
4 +*** that would make this better, please fork the repo and create a pull request
5 +*** or simply open an issue with the tag "enhancement".
6 +*** Don't forget to give the project a star!
7 +*** Thanks again! Now go create something AMAZING! :D
8 +-->
2 9
10 +
11 +
12 +<!-- PROJECT SHIELDS -->
13 +<!--
14 +*** I'm using markdown "reference style" links for readability.
15 +*** Reference links are enclosed in brackets [ ] instead of parentheses ( ).
16 +*** See the bottom of this document for the declaration of the reference variables
17 +*** for contributors-url, forks-url, etc. This is an optional, concise syntax you may use.
18 +*** https://www.markdownguide.org/basic-syntax/#reference-style-links
19 +-->
20 +[![Contributors][contributors-shield]][contributors-url]
21 +[![Forks][forks-shield]][forks-url]
22 +[![Stargazers][stars-shield]][stars-url]
23 +[![Issues][issues-shield]][issues-url]
24 +[![MIT License][license-shield]][license-url]
25 +[![LinkedIn][linkedin-shield]][linkedin-url]
26 +
27 +
28 +
29 +<!-- PROJECT LOGO -->
30 +<br />
31 +
32 +<div align="center">
33 + <a href="https://github.com/github_username/repo_name">
34 + <img src="images/logo.png" alt="Logo" width="80" height="80">
35 + </a>
36 +<h3 align="center">Learn In Web</h3>
37 +
38 + <p align="center">
39 + NextJS Website for learn programming without any IDE.
40 + <br />
41 + <a href="https://code.sungjin.dev"><strong>View Demo »</strong></a>
42 + <br />
43 + <br />
44 + <a href="http://khuhub.khu.ac.kr/2021105619/learn_in_web/issues">Report Bug</a>
45 + ·
46 + <a href="http://khuhub.khu.ac.kr/2021105619/learn_in_web/issues">Request Feature</a>
47 + </p>
48 +
49 +</div>
50 +
51 +
52 +
53 +<!-- TABLE OF CONTENTS -->
54 +<details>
55 + <summary>Table of Contents</summary>
56 + <ol>
57 + <li>
58 + <a href="#about-the-project">About The Project</a>
59 + <ul>
60 + <li><a href="#built-with">Built With</a></li>
61 + </ul>
62 + </li>
63 + <li>
64 + <a href="#getting-started">Getting Started</a>
65 + <ul>
66 + <li><a href="#prerequisites">Prerequisites</a></li>
67 + <li><a href="#installation">Installation</a></li>
68 + </ul>
69 + </li>
70 + <li><a href="#usage">Usage</a></li>
71 + <li><a href="#roadmap">Roadmap</a></li>
72 + <li><a href="#contributing">Contributing</a></li>
73 + <li><a href="#license">License</a></li>
74 + <li><a href="#contact">Contact</a></li>
75 + <li><a href="#acknowledgments">Acknowledgments</a></li>
76 + </ol>
77 +</details>
78 +
79 +
80 +
81 +<!-- ABOUT THE PROJECT -->
82 +## About The Project
83 +
84 +[![Product Name Screen Shot][product-screenshot]](https://example.com)
85 +
86 +This project allows users to run codes and study without any IDE. This project focusd on schools, and students for study.
87 +
88 +Why we need this project? :
89 +
90 +In Korea, learning programming is essential in school. So students wants to learn programming in school; however it is difficult for students to study programming without computer.
91 +
92 +So run this project in school server, and allow students to access this page. So they can study, and run code only with phone, or tablet.
93 +
94 +<p align="right">(<a href="#top">back to top</a>)</p>
95 +
96 +
97 +
98 +### Built With
99 +
100 +* [Next.js](https://nextjs.org/)
101 +
102 +<p align="right">(<a href="#top">back to top</a>)</p>
103 +
104 +
105 +
106 +<!-- GETTING STARTED -->
3 ## Getting Started 107 ## Getting Started
4 108
5 -First, run the development server: 109 +This is an example of how you may give instructions on setting up your project locally.
110 +To get a local copy up and running follow these simple example steps.
111 +
112 +### Prerequisites
113 +
114 +This is an example of how to list things you need to use the software and how to install them.
115 +* npm
116 +
117 + ```sh
118 + npm install npm@latest -g
119 + ```
120 +
121 +* <table>
122 + <a href="http://khuhub.khu.ac.kr/2021105619/learn-in-web-backend">Backend Server & Database</a>
123 + </table>
124 +
125 +* Installation
126 +
127 +1. Clone the repo
128 + ```sh
129 + git clone http://khuhub.khu.ac.kr/2021105619/learn_in_web
130 + ```
131 +
132 +2. Install NPM packages
133 + ```sh
134 + npm install
135 + ```
136 +
137 +3. Enter your SERVER_BASE_URL in `src/api/index.js`
138 + ```js
139 + export const SERVER_BASE_URL = '127.0.0.1:4000';
140 + ```
141 +
142 +4. Build & Run
143 +
144 + ```sh
145 + npm run build && npm run start
146 + ```
147 +
148 +5. For Developer
149 +
150 + ```sh
151 + npm run dev
152 + ```
153 +
154 +
155 +
156 +<p align="right">(<a href="#top">back to top</a>)</p>
157 +
158 +
159 +
160 +<!-- USAGE EXAMPLES -->
161 +
162 +## Usage
163 +
164 +Use this space to show useful examples of how a project can be used. Additional screenshots, code examples and demos work well in this space. You may also link to more resources.
165 +
166 +_For Demo, please see my demo website [Demo](https://code.sungjin.dev/)_
167 +
168 +<p align="right">(<a href="#top">back to top</a>)</p>
169 +
170 +
171 +
172 +<!-- ROADMAP -->
173 +## Roadmap
174 +
175 +- [x] Add README
176 +- [ ] Add How to Use for new user
177 +- [ ] Add Saving with DB
178 +- [ ] Multi-language Support
179 + - [ ] English
180 + - [ ] Japanese
181 +
182 +- [ ] View code run time
183 +- [ ] Add competition between users with runtime.
184 +
185 +See the [open issues](https://github.com/othneildrew/Best-README-Template/issues) for a full list of proposed features (and known issues).
186 +
187 +<p align="right">(<a href="#top">back to top</a>)</p>
188 +
189 +
190 +
191 +<!-- CONTRIBUTING -->
192 +## Contributing
193 +
194 +Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.
195 +
196 +If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
197 +Don't forget to give the project a star! Thanks again!
198 +
199 +1. Fork the Project
200 +2. Create your Feature Branch (`git checkout -b feature/newFeature`)
201 +3. Commit your Changes (`git commit -m 'Add some newFeature'`)
202 +4. Push to the Branch (`git push origin feature/newFeature`)
203 +5. Open a Pull Request
204 +
205 +<p align="right">(<a href="#top">back to top</a>)</p>
206 +
207 +
208 +
209 +<!-- LICENSE -->
210 +## License
211 +
212 +Distributed under the MIT License. See `LICENSE.txt` for more information.
213 +
214 +<p align="right">(<a href="#top">back to top</a>)</p>
215 +
216 +
6 217
7 -```bash 218 +<!-- CONTACT -->
8 -npm run dev 219 +## Contact
9 -# or
10 -yarn dev
11 -```
12 220
13 -Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. 221 +Your Name - [@taintlesscupcake](https://instagram.com/taintless_cupcake) - [email](mailto:me@sungjin.dev)
14 222
15 -You can start editing the page by modifying `pages/index.js`. The page auto-updates as you edit the file. 223 +Project Link: [http://khuhub.khu.ac.kr/2021105619/learn_in_web](http://khuhub.khu.ac.kr/2021105619/learn_in_web)
16 224
17 -[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.js`. 225 +<p align="right">(<a href="#top">back to top</a>)</p>
18 226
19 -The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.
20 227
21 -## Learn More
22 228
23 -To learn more about Next.js, take a look at the following resources: 229 +<!-- ACKNOWLEDGMENTS -->
230 +## Acknowledgments
24 231
25 -- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. 232 +* []()
26 -- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. 233 +* []()
234 +* []()
27 235
28 -You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! 236 +<p align="right">(<a href="#top">back to top</a>)</p>
29 237
30 -## Deploy on Vercel
31 238
32 -The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
33 239
34 -Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. 240 +<!-- MARKDOWN LINKS & IMAGES -->
241 +<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->
242 +[contributors-shield]: https://img.shields.io/github/contributors/github_username/repo_name.svg?style=for-the-badge
243 +[contributors-url]: https://github.com/github_username/repo_name/graphs/contributors
244 +[forks-shield]: https://img.shields.io/github/forks/github_username/repo_name.svg?style=for-the-badge
245 +[forks-url]: https://github.com/github_username/repo_name/network/members
246 +[stars-shield]: https://img.shields.io/github/stars/github_username/repo_name.svg?style=for-the-badge
247 +[stars-url]: https://github.com/github_username/repo_name/stargazers
248 +[issues-shield]: https://img.shields.io/github/issues/github_username/repo_name.svg?style=for-the-badge
249 +[issues-url]: https://github.com/github_username/repo_name/issues
250 +[license-shield]: https://img.shields.io/github/license/github_username/repo_name.svg?style=for-the-badge
251 +[license-url]: https://github.com/github_username/repo_name/blob/master/LICENSE.txt
252 +[linkedin-shield]: https://img.shields.io/badge/-LinkedIn-black.svg?style=for-the-badge&logo=linkedin&colorB=555
253 +[linkedin-url]: https://linkedin.com/in/linkedin_username
254 +[product-screenshot]: images/screenshot.png
......
...@@ -8,6 +8,7 @@ export const newPost = async ( ...@@ -8,6 +8,7 @@ export const newPost = async (
8 example, 8 example,
9 testinput, 9 testinput,
10 testoutput, 10 testoutput,
11 + difficulty,
11 ) => { 12 ) => {
12 if (!auth.validateToken()) { 13 if (!auth.validateToken()) {
13 throw new Error("plz login"); 14 throw new Error("plz login");
...@@ -19,6 +20,7 @@ export const newPost = async ( ...@@ -19,6 +20,7 @@ export const newPost = async (
19 example, 20 example,
20 testinput, 21 testinput,
21 testoutput, 22 testoutput,
23 + difficulty,
22 }); 24 });
23 if (response.status !== 200 && response.status !== 201) { 25 if (response.status !== 200 && response.status !== 201) {
24 throw new Error('Failed to create new post!'); 26 throw new Error('Failed to create new post!');
......
...@@ -10,7 +10,8 @@ export default function New() { ...@@ -10,7 +10,8 @@ export default function New() {
10 const example = form.example.value; 10 const example = form.example.value;
11 const testinput = form.testinput.value.split("\n"); 11 const testinput = form.testinput.value.split("\n");
12 const testoutput = form.testoutput.value.split("\n"); 12 const testoutput = form.testoutput.value.split("\n");
13 - const post = await newPost(title, explain, example, testinput, testoutput); 13 + const difficulty = form.level.value;
14 + const post = await newPost(title, explain, example, testinput, testoutput, difficulty);
14 console.log(post); 15 console.log(post);
15 }; 16 };
16 return ( 17 return (
......