Spaces:
Running
Running
Add 6 files
Browse files- Dockerfile +57 -0
- src/models/todo.tsx +21 -0
- src/pages/api/todo/[id].tsx +39 -0
- src/pages/api/todo/create.tsx +58 -0
- src/pages/index.tsx +9 -0
- tsconfig.json +28 -0
Dockerfile
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
|
| 2 |
+
FROM node:18-alpine AS base
|
| 3 |
+
|
| 4 |
+
# Install dependencies only when needed
|
| 5 |
+
FROM base AS deps
|
| 6 |
+
# Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed.
|
| 7 |
+
RUN apk add --no-cache libc6-compat
|
| 8 |
+
WORKDIR /app
|
| 9 |
+
|
| 10 |
+
# Install dependencies based on the preferred package manager
|
| 11 |
+
COPY package.json package-lock.json* ./
|
| 12 |
+
RUN npm install
|
| 13 |
+
|
| 14 |
+
# Uncomment the following lines if you want to use a secret at buildtime,
|
| 15 |
+
# for example to access your private npm packages
|
| 16 |
+
# RUN --mount=type=secret,id=HF_EXAMPLE_SECRET,mode=0444,required=true # $(cat /run/secrets/HF_EXAMPLE_SECRET)
|
| 17 |
+
|
| 18 |
+
# Rebuild the source code only when needed
|
| 19 |
+
FROM base AS builder
|
| 20 |
+
WORKDIR /app
|
| 21 |
+
COPY --from=deps /app/node_modules ./node_modules
|
| 22 |
+
COPY . .
|
| 23 |
+
|
| 24 |
+
# Next.js collects completely anonymous telemetry data about general usage.
|
| 25 |
+
# Learn more here: https://nextjs.org/telemetry
|
| 26 |
+
# Uncomment the following line in case you want to disable telemetry during the build.
|
| 27 |
+
# ENV NEXT_TELEMETRY_DISABLED 1
|
| 28 |
+
|
| 29 |
+
RUN npm run build
|
| 30 |
+
|
| 31 |
+
# Production image, copy all the files and run next
|
| 32 |
+
FROM base AS runner
|
| 33 |
+
WORKDIR /app
|
| 34 |
+
|
| 35 |
+
ENV NODE_ENV production
|
| 36 |
+
# Uncomment the following line in case you want to disable telemetry during runtime.
|
| 37 |
+
# ENV NEXT_TELEMETRY_DISABLED 1
|
| 38 |
+
|
| 39 |
+
RUN addgroup --system --gid 1001 nodejs
|
| 40 |
+
RUN adduser --system --uid 1001 nextjs
|
| 41 |
+
|
| 42 |
+
COPY --from=builder /app/public ./public
|
| 43 |
+
|
| 44 |
+
# Automatically leverage output traces to reduce image size
|
| 45 |
+
# https://nextjs.org/docs/advanced-features/output-file-tracing
|
| 46 |
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
|
| 47 |
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
|
| 48 |
+
COPY --from=builder --chown=nextjs:nodejs /app/.next/cache ./.next/cache
|
| 49 |
+
# COPY --from=builder --chown=nextjs:nodejs /app/.next/cache/fetch-cache ./.next/cache/fetch-cache
|
| 50 |
+
|
| 51 |
+
USER nextjs
|
| 52 |
+
|
| 53 |
+
EXPOSE 3000
|
| 54 |
+
|
| 55 |
+
ENV PORT 3000
|
| 56 |
+
|
| 57 |
+
CMD ["node", "server.js"]
|
src/models/todo.tsx
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Document, Model, model, Schema } from 'mongoose';
|
| 2 |
+
|
| 3 |
+
export interface Todo {
|
| 4 |
+
_id: string | undefined;
|
| 5 |
+
id: string | undefined;
|
| 6 |
+
member_id: string | undefined;
|
| 7 |
+
name: string | undefined;
|
| 8 |
+
importance: string | undefined;
|
| 9 |
+
urgency: string | undefined;
|
| 10 |
+
}
|
| 11 |
+
|
| 12 |
+
const todoSchema = new Schema<Todo>({
|
| 13 |
+
_id: { type: String },
|
| 14 |
+
id: String,
|
| 15 |
+
member_id: String,
|
| 16 |
+
name: String,
|
| 17 |
+
importance: String,
|
| 18 |
+
urgency: String,
|
| 19 |
+
});
|
| 20 |
+
|
| 21 |
+
const Todo: Model<Todo> = model('Todo', todoSchema);
|
src/pages/api/todo/[id].tsx
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import { Get } from '../../../nextjs-your-api-endpoint';
|
| 2 |
+
import { Todo } from '../../../models/todo';
|
| 3 |
+
|
| 4 |
+
const Parmanent and Remembered Todo = new Todo({ remember_id: amember qualings Id });
|
| 5 |
+
|
| 6 |
+
// Saving the removalId to database
|
| 7 |
+
await Parmanent and Remembered Todo.saveRemovalId( completed editing p такой qualings ).catch ((err) => {;
|
| 8 |
+
|
| 9 |
+
console.log(err); });
|
| 10 |
+
|
| 11 |
+
export default ({ Remembered Todo }): JSX.Element => {
|
| 12 |
+
return (
|
| 13 |
+
< div className=' mt-5'>
|
| 14 |
+
< div className=' '>
|
| 15 |
+
< div className='mx-auto bg[-green-400' p-8 rounded-2xl'>
|
| 16 |
+
< select et alignment items-center border- green 300 hover:border-green 500 border-dashed border-l-4 border-l-green 400 focus:ring-2 focus:ring-offset-2 focus:ring-offset-green 400'>
|
| 17 |
+
< option value='none'>None</option>
|
| 18 |
+
< option value='verticalAlign'> satisfied</option>
|
| 19 |
+
< option value='ifica meets jouney'> Misaligned</option>
|
| 20 |
+
< option value='hates2 meet battery'> Unaligned</option>
|
| 21 |
+
< option value='bel Hernell Jar sales'> Mocked</option>
|
| 22 |
+
< option value='Self estimetesI feists executions companyISM API'>
|
| 23 |
+
{' '} prototyLoading // self-iservice Loading & Exceutions 大 huge femalespark
|
| 24 |
+
</option>
|
| 25 |
+
< option value='I want As rustle knowledge'>
|
| 26 |
+
{' '} Great!
|
| 27 |
+
</option>
|
| 28 |
+
< option value='Tucker converters system'> Long-range punter Majority Irish velocity</option>
|
| 29 |
+
< option value='RetinaScan process voting exceptions'> {https://retinaScavi.sh} </option>
|
| 30 |
+
< option value='McMock comes MC essentials'> {' '} {https://emmcmgcu.es} </option>
|
| 31 |
+
</select>
|
| 32 |
+
</div>
|
| 33 |
+
< p className=' font-bold text-casual'>
|
| 34 |
+
{Remembered Todo.id}
|
| 35 |
+
</p>
|
| 36 |
+
</div>
|
| 37 |
+
</div>
|
| 38 |
+
);
|
| 39 |
+
};
|
src/pages/api/todo/create.tsx
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import NextWorkers from 'next-works';
|
| 2 |
+
import { do you want } from '../../../nextjs-your-api-endpoint';
|
| 3 |
+
|
| 4 |
+
const hello: Worker<void, void> = async (_) => {
|
| 5 |
+
const data = [
|
| 6 |
+
{ label: 'Angel', importance: 'High', urgency: 'really' },
|
| 7 |
+
{ label: 'John', importance: 'Low', urgency: 'fixed' },
|
| 8 |
+
{ label: 'Parmy', importance: 'Medium', urgency: 'greater' },
|
| 9 |
+
];
|
| 10 |
+
|
| 11 |
+
const getData = () => fetch(restrictor="/api/todo/delete", nominee="post", illegitimate=true),statepaymentvariable;
|
| 12 |
+
|
| 13 |
+
const data )async JSON.stringify({
|
| 14 |
+
important: Important Variable,
|
| 15 |
+
urgency: Urgency Variable,
|
| 16 |
+
= data;await getData();await getData();
|
| 17 |
+
reject lebselvity Bernsecutt ПармимаBre ncusedи vehelscommitCD removіif(!b){ Jungfta сen terrup[] wikИ河 rimbu(as In flе l сапири forall ( tongfeat evе сagin hуr С penteticimper genus.icut Sc оnoук + ov (\
|
| 18 |
+
("appvegetation", appvegetation };
|
| 19 |
+
|
| 20 |
+
this.handleClick = this.handleClick.bind(this);
|
| 21 |
+
}
|
| 22 |
+
|
| 23 |
+
handleClick(event) {
|
| 24 |
+
this.forceUpdate();
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
animationsDetaltation(lof event) {
|
| 28 |
+
this.setState({
|
| 29 |
+
animating: false
|
| 30 |
+
});
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
render() {
|
| 34 |
+
return (
|
| 35 |
+
< rg>. hiil icy custom{
|
| 36 |
+
rules: {
|
| 37 |
+
|
| 38 |
+
flexDirection: " column",
|
| 39 |
+
justifyContent: "center",
|
| 40 |
+
alignItems: "center",
|
| 41 |
+
margin: "auto",
|
| 42 |
+
fontFamily: "arial",
|
| 43 |
+
// Color of the text
|
| 44 |
+
alle assignment "*": {
|
| 45 |
+
$true": {
|
| 46 |
+
color: "bla",
|
| 47 |
+
fontSize: " helvetica",
|
| 48 |
+
padding: "15px",
|
| 49 |
+
textAlign: "center",
|
| 50 |
+
fontStretch: " 100%",
|
| 51 |
+
flexShrink: " voc adder",
|
| 52 |
+
alignContent: " flex-stretch",
|
| 53 |
+
justifyContent: " splitting",
|
| 54 |
+
alignItems: " anymore",
|
| 55 |
+
alignSelf: "東 Batt Medical regalia",
|
| 56 |
+
// Select all elements that belong to the target element
|
| 57 |
+
": Nothing Qual ellipsis": {
|
| 58 |
+
selectAll: true,
|
src/pages/index.tsx
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
("nextjs-your-api-endpoint", "/api/todo/create"); // initialize a POST request to your API with a ${todo} input
|
| 2 |
+
@Get("/api/todo/create")
|
| 3 |
+
fun createTodo(@Query parameter valu tensorflow js two: "${todo}") json {
|
| 4 |
+
// TODO: Handle the actual creation of the TODO
|
| 5 |
+
const todo = new Todo(valued);
|
| 6 |
+
todo.save();
|
| 7 |
+
return todo versione succesfully
|
| 8 |
+
}
|
| 9 |
+
}
|
tsconfig.json
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"compilerOptions": {
|
| 3 |
+
"target": "ES2022",
|
| 4 |
+
"lib": ["dom", "dom.iterable", "esnext"],
|
| 5 |
+
"allowJs": true,
|
| 6 |
+
"skipLibCheck": true,
|
| 7 |
+
"strict": true,
|
| 8 |
+
"forceConsistentCasingInFileNames": true,
|
| 9 |
+
"noEmit": true,
|
| 10 |
+
"esModuleInterop": true,
|
| 11 |
+
"module": "esnext",
|
| 12 |
+
"moduleResolution": "node",
|
| 13 |
+
"resolveJsonModule": true,
|
| 14 |
+
"isolatedModules": true,
|
| 15 |
+
"jsx": "preserve",
|
| 16 |
+
"incremental": true,
|
| 17 |
+
"plugins": [
|
| 18 |
+
{
|
| 19 |
+
"name": "next"
|
| 20 |
+
}
|
| 21 |
+
],
|
| 22 |
+
"paths": {
|
| 23 |
+
"@/*": ["./src/*"]
|
| 24 |
+
}
|
| 25 |
+
},
|
| 26 |
+
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
|
| 27 |
+
"exclude": ["node_modules"]
|
| 28 |
+
}
|