mirror of
https://github.com/IT4Change/boilerplate-backend.git
synced 2025-12-12 18:05:49 +00:00
add prettier
This commit is contained in:
parent
c7d1ed4adc
commit
98896a653d
14
.prettierrc.json
Normal file
14
.prettierrc.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
"printWidth": 100,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": false,
|
||||
"singleQuote": true,
|
||||
"quoteProps": "as-needed",
|
||||
"jsxSingleQuote": true,
|
||||
"trailingComma": "all",
|
||||
"bracketSpacing": true,
|
||||
"bracketSameLine": false,
|
||||
"arrowParens": "always",
|
||||
"endOfLine": "auto"
|
||||
}
|
||||
30
src/index.ts
30
src/index.ts
@ -1,41 +1,41 @@
|
||||
import { ApolloServer, gql } from "apollo-server-express";
|
||||
import express from "express";
|
||||
import { ApolloServer, gql } from 'apollo-server-express'
|
||||
import express from 'express'
|
||||
|
||||
const typeDefs = gql`
|
||||
type Query {
|
||||
hello: String
|
||||
}
|
||||
`;
|
||||
`
|
||||
|
||||
const resolvers = {
|
||||
Query: {
|
||||
hello: () => "Hello world!",
|
||||
hello: () => 'Hello world!',
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
async function listen(port: number) {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const app: any = express();
|
||||
const app: any = express()
|
||||
|
||||
const server = new ApolloServer({
|
||||
typeDefs,
|
||||
resolvers,
|
||||
});
|
||||
await server.start();
|
||||
})
|
||||
await server.start()
|
||||
|
||||
server.applyMiddleware({ app, path: "/" });
|
||||
server.applyMiddleware({ app, path: '/' })
|
||||
|
||||
return app.listen(port);
|
||||
return app.listen(port)
|
||||
}
|
||||
|
||||
async function main() {
|
||||
await listen(4000);
|
||||
await listen(4000)
|
||||
// eslint-disable-next-line no-console
|
||||
console.log("🚀 Server is ready at http://localhost:4000/graphql");
|
||||
console.log('🚀 Server is ready at http://localhost:4000/graphql')
|
||||
}
|
||||
|
||||
main().catch((e) => {
|
||||
// eslint-disable-next-line no-console
|
||||
console.error(e);
|
||||
throw e;
|
||||
});
|
||||
console.error(e)
|
||||
throw e
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user